Skip to content

Commit 195165c

Browse files
committed
glfw34: update to typesetting with fix for new glyph access methods
1 parent 4e0b144 commit 195165c

3 files changed

Lines changed: 13 additions & 26 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/fsnotify/fsnotify v1.9.0
2222
github.com/go-fonts/latin-modern v0.3.3
2323
github.com/go-gl/glfw/v3.4/glfw v0.1.0-pre.1
24-
github.com/go-text/typesetting v0.3.1-0.20250707124828-58cd3ef91251
24+
github.com/go-text/typesetting v0.3.5-0.20260418130854-c41d02a44bec
2525
github.com/gomarkdown/markdown v0.0.0-20250810172220-2e2c11897d1a
2626
github.com/gorilla/websocket v1.5.3
2727
github.com/grokify/html-strip-tags-go v0.1.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ github.com/go-gl/glfw/v3.4/glfw v0.1.0-pre.1 h1:nIVzcwqIaO1mK8LFr0fGkKpgQD4wJDDH
6060
github.com/go-gl/glfw/v3.4/glfw v0.1.0-pre.1/go.mod h1:T5Dn0JwIJOX1euPZ/iT4tq6nFYtmukjcYa7937HuYK8=
6161
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
6262
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
63-
github.com/go-text/typesetting v0.3.1-0.20250707124828-58cd3ef91251 h1:QRcFLinlR2DKeVdwo/hwyz9S5HSzUiXnV0pzX/dhKOg=
64-
github.com/go-text/typesetting v0.3.1-0.20250707124828-58cd3ef91251/go.mod h1:Fle5OPkxGUxdWDeCpKpvSCE31gEoTGBh63ASvTmSXBA=
65-
github.com/go-text/typesetting-utils v0.0.0-20250527170436-63e4acdcf075 h1:zRaPuzKe/+Euzz3WwE0YwjXAX4IwvGPRH6abtmRI/4M=
66-
github.com/go-text/typesetting-utils v0.0.0-20250527170436-63e4acdcf075/go.mod h1:DDxDdQEnB70R8owOx3LVpEFvpMK9eeH1o2r0yZhFI9o=
63+
github.com/go-text/typesetting v0.3.5-0.20260418130854-c41d02a44bec h1:qkk9+cZlaY8920dQrhY8GoI91N72f58XmJgGDkkDiaA=
64+
github.com/go-text/typesetting v0.3.5-0.20260418130854-c41d02a44bec/go.mod h1:yW47fmJYxJsPcyNWEOGM2lNx766ZKw0cilos3XaD5YY=
65+
github.com/go-text/typesetting-utils v0.0.0-20260327125527-fbf04b32d9ad h1:J6fi06yzug4KkyQo0hK7UZVFBIlCh7iaG38sGq7THaY=
66+
github.com/go-text/typesetting-utils v0.0.0-20260327125527-fbf04b32d9ad/go.mod h1:3/62I4La/HBRX9TcTpBj4eipLiwzf+vhI+7whTc9V7o=
6767
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
6868
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
6969
github.com/gomarkdown/markdown v0.0.0-20250810172220-2e2c11897d1a h1:l7A0loSszR5zHd/qK53ZIHMO8b3bBSmENnQ6eKnUT0A=

paint/renderers/rasterx/text.go

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,15 @@ func (rs *Renderer) TextRun(ctx *render.Context, run *shapedgt.Run, ln *shaped.L
156156
pos := off.Add(math32.Vec2(math32.FromFixed(g.XOffset), -math32.FromFixed(g.YOffset)))
157157
bb := run.GlyphBoundsBox(g).Translate(off)
158158
// rs.StrokeBounds(ctx, bb, colors.Yellow)
159-
160-
data := run.Face.GlyphData(g.GlyphID)
161-
switch format := data.(type) {
162-
case font.GlyphOutline:
163-
rs.GlyphOutline(ctx, run, g, format, fill, stroke, bb, pos, identity)
164-
case font.GlyphBitmap:
165-
rs.GlyphBitmap(ctx, run, g, format, fill, stroke, bb, pos, identity)
166-
case font.GlyphSVG:
167-
rs.GlyphSVG(ctx, run, g, format.Source, bb, pos, identity)
168-
default:
169-
fmt.Printf("unrecognized glyph data: %T\n", data)
159+
if data, ok := run.Face.GlyphDataSVG(g.GlyphID); ok {
160+
rs.GlyphSVG(ctx, run, g, data.Source, bb, pos, identity)
161+
} else if data, ok := run.Face.GlyphDataBitmap(g.GlyphID); ok {
162+
rs.GlyphBitmap(ctx, run, g, data, fill, stroke, bb, pos, identity)
163+
} else if data, ok := run.Face.GlyphDataOutline(g.GlyphID); ok {
164+
rs.GlyphOutline(ctx, run, g, data, fill, stroke, bb, pos, identity)
165+
} else {
166+
fmt.Printf("unrecognized glyph data for glyphID: %v, face: %v\n", g.GlyphID, run.Face.Describe().Family)
170167
}
171-
// todo: once https://github.com/go-text/typesetting/pull/254 is merged
172-
// if data, ok := run.Face.GlyphDataSVG(g.GlyphID); ok {
173-
// rs.GlyphSVG(ctx, run, g, data.Source, bb, pos, identity)
174-
// } else if data, ok := run.Face.GlyphDataBitmap(g.GlyphID); ok {
175-
// rs.GlyphBitmap(ctx, run, g, data, fill, stroke, bb, pos, identity)
176-
// } else if data, ok := run.Face.GlyphDataOutline(g.GlyphID); ok {
177-
// rs.GlyphOutline(ctx, run, g, data, fill, stroke, bb, pos, identity)
178-
// } else {
179-
// fmt.Printf("unrecognized glyph data for glyphID: %v, face: %v\n", g.GlyphID, run.Face.Describe().Family)
180-
// }
181168
off.X += math32.FromFixed(g.XAdvance)
182169
off.Y -= math32.FromFixed(g.YAdvance)
183170
}

0 commit comments

Comments
 (0)