text: render SVG font as black-white outline

Previously, using SVG fonts will cause Gio to render invisible
"characters".

Now, some fonts (like Noto Sans Emoji) will be rendered
based on "Outline". Gio don't support SVG fonts, but now
it will show the outline ("black-and-white") alternative.

Signed-off-by: Lucas Rodrigues <inkeliz@inkeliz.com>
This commit is contained in:
Lucas Rodrigues
2026-03-09 23:54:00 +00:00
committed by Chris Waldon
parent c3a6e85f5c
commit 65d86895b8
+10 -3
View File
@@ -656,12 +656,20 @@ func (s *shaperImpl) Shape(pathOps *op.Ops, gs []Glyph) clip.PathSpec {
}
scaleFactor := fixedToFloat(ppem) / float32(face.Upem())
glyphData := face.GlyphData(gid)
var outline font.GlyphOutline
switch glyphData := glyphData.(type) {
case font.GlyphOutline:
outline := glyphData
outline = glyphData
case font.GlyphSVG:
outline = glyphData.Outline
default:
continue
}
// Move to glyph position.
pos := f32.Point{
X: fixedToFloat((g.X - x) + g.Offset.X),
X: fixedToFloat((g.X - x) - g.Offset.X),
Y: -fixedToFloat(g.Offset.Y),
}
builder.Move(pos.Sub(lastPos))
@@ -703,7 +711,6 @@ func (s *shaperImpl) Shape(pathOps *op.Ops, gs []Glyph) clip.PathSpec {
}
lastPos = lastPos.Add(lastArg)
}
}
return builder.End()
}