Closed andydotxyz closed 1 year ago
@andydotxyz We use this exact font in some Gio examples and it reports PNG data. Here's the place where we decode that. I can't explain why go-text would give you different results for the same font.
Yeah it is a bit strange. The following code demos it:
func Test_Format(t *testing.T) {
text := "😀"
data, _ := os.Open("/Users/andy/Downloads/Noto_Color_Emoji/NotoColorEmoji-Regular.ttf")
f, _ := font.ParseTTF(data)
in := shaping.Input{
Text: []rune(text),
RunStart: 0,
RunEnd: len(text),
Face: f,
Size: fixed.I(24),
}
out := (&shaping.HarfbuzzShaper{}).Shape(in)
if f.GlyphData(out.Glyphs[0].GlyphID).(api.GlyphBitmap).Format != api.PNG {
t.Error("Wrong format reported")
}
}
@andydotxyz I've just run the above test with NotoColorEmoji-Regular.ttf (sha1sum: d7002ca4983e7f129683d056fe14d5fe43060f54), and I've found no issue !
Some precision:
in.Text == []rune{128512}
out.Glyphs[0].GlyphID == 2283
f.GlyphData(2283)
returns a valid GlyphSVG, with a valid (non-empty) Source fieldCould you check you have the same sha1sum and runes and glyphs numbers ? (Perhaps I somehow didn't download the proper font )
Thanks, I was chasing the wrong thread. It was indeed an SVG font so no error with being not PNG. Once ascertained casting to GlyphSVG instead of GlyphBitmap did indeed reveal a Source field with the content as expected.
Sorry for the confusion.
Thanks, I was chasing the wrong thread. It was indeed an SVG font so no error with being not PNG. Once ascertained casting to GlyphSVG instead of GlyphBitmap did indeed reveal a Source field with the content as expected.
Sorry for the confusion.
No worries, thank you for double checking that. Should we close this issue ?
Oops sorry :)
On using the note sans colour emoji font (https://fonts.google.com/noto/specimen/Noto+Color+Emoji) I get a font loaded that claims to be SVG format, but the data slice is
nil
for standard emoji character lookup.I am not sure if it should be reporting PNG or SVG, but the data being nil meant I could not guess ;).