go.mod: upgrade to github.com/go-text/typesetting@v0.3.4

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
Egon Elbre
2026-05-08 18:38:20 +03:00
committed by Chris Waldon
parent e2e2c1a046
commit dec57aea1c
5 changed files with 19 additions and 22 deletions
+9 -12
View File
@@ -103,8 +103,7 @@ func (l *line) insertTrailingSyntheticNewline(newLineClusterIdx int) {
clusterIndex: newLineClusterIdx,
glyphCount: 0,
runeCount: 1,
xAdvance: 0,
yAdvance: 0,
advance: 0,
xOffset: 0,
yOffset: 0,
}
@@ -160,9 +159,9 @@ type glyph struct {
// runeCount is the quantity of runes in the source text that this glyph
// corresponds to.
runeCount int
// xAdvance and yAdvance describe the distance the dot moves when
// laying out the glyph on the X or Y axis.
xAdvance, yAdvance fixed.Int26_6
// advance is the distance the dot moves when laying out the glyph along
// the run's primary axis.
advance fixed.Int26_6
// xOffset and yOffset describe offsets from the dot that should be
// applied when rendering the glyph.
xOffset, yOffset fixed.Int26_6
@@ -438,8 +437,7 @@ func (s *shaperImpl) shapeText(ppem fixed.Int26_6, lc system.Locale, txt []rune)
Height: input.Size,
XBearing: 0,
YBearing: 0,
XAdvance: input.Size,
YAdvance: input.Size,
Advance: input.Size,
XOffset: 0,
YOffset: 0,
ClusterIndex: input.RunStart,
@@ -855,11 +853,10 @@ func toGioGlyphs(in []shaping.Glyph, ppem fixed.Int26_6, faceIdx int) []glyph {
bounds.Max = bounds.Min.Add(fixed.Point26_6{X: g.Width, Y: -g.Height})
out = append(out, glyph{
id: newGlyphID(ppem, faceIdx, g.GlyphID),
clusterIndex: g.ClusterIndex,
runeCount: g.RuneCount,
glyphCount: g.GlyphCount,
xAdvance: g.XAdvance,
yAdvance: g.YAdvance,
clusterIndex: g.TextIndex(),
runeCount: g.RunesCount(),
glyphCount: g.GlyphsCount(),
advance: g.Advance,
xOffset: g.XOffset,
yOffset: g.YOffset,
bounds: bounds,
+3 -3
View File
@@ -464,7 +464,7 @@ func (l *Shaper) NextGlyph() (_ Glyph, ok bool) {
if rtl {
// Modify the advance prior to computing runOffset to ensure that the
// current glyph's width is subtracted in RTL.
l.advance += g.xAdvance
l.advance += g.advance
}
// runOffset computes how far into the run the dot should be positioned.
runOffset := l.advance
@@ -477,7 +477,7 @@ func (l *Shaper) NextGlyph() (_ Glyph, ok bool) {
Y: int32(line.yOffset),
Ascent: line.ascent,
Descent: line.descent,
Advance: g.xAdvance,
Advance: g.advance,
Runes: uint16(g.runeCount),
Offset: fixed.Point26_6{
X: g.xOffset,
@@ -490,7 +490,7 @@ func (l *Shaper) NextGlyph() (_ Glyph, ok bool) {
}
l.glyph++
if !rtl {
l.advance += g.xAdvance
l.advance += g.advance
}
endOfRun := l.glyph == len(run.Glyphs)
+2 -2
View File
@@ -450,8 +450,8 @@ func printLinePositioning(t *testing.T, lines []line, glyphs []Glyph) {
for g := start; ; g += inc {
glyph := run.Glyphs[g]
if glyphCursor < len(glyphs) {
t.Logf("glyph %2d, adv %3d, runes %2d, glyphs %d - glyphs[%2d] flags %s", g, glyph.xAdvance, glyph.runeCount, glyph.glyphCount, glyphCursor, glyphs[glyphCursor].Flags)
t.Logf("glyph %2d, adv %3d, runes %2d, glyphs %d - n/a", g, glyph.xAdvance, glyph.runeCount, glyph.glyphCount)
t.Logf("glyph %2d, adv %3d, runes %2d, glyphs %d - glyphs[%2d] flags %s", g, glyph.advance, glyph.runeCount, glyph.glyphCount, glyphCursor, glyphs[glyphCursor].Flags)
t.Logf("glyph %2d, adv %3d, runes %2d, glyphs %d - n/a", g, glyph.advance, glyph.runeCount, glyph.glyphCount)
}
glyphCursor++
if g == end {