x/image/font/sfnt: not all tables begin with four byte boundries #46384
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/0_ESQiUzpHy
/usr/share/fonts/truetype/wqy-zenhei.ttc is "WenQuanYi Zen Hei", the primary Simplified Chinese font for many Linux distributions for many years before Noto Sans CJK. nowadays many distributions still provide it, and some of them still don't have Noto Sans CJK fonts and didn't switch their default SC font yet. BTW, fontconfig project set it as the default SC font for programs relying on it without tweak.
In one word, if you want to print something Chinese with golang/x/image/font infrastructure, "wqy-zenhei.ttc" may come to your mind definitely.
What did you expect to see?
nil error
What did you see instead?
sfnt: invalid table offset
I print the tag with:
And find a weird tag "BDF" and "FFTM" , after some research I found they are fontforge specific tables, and are non-standard extension for opentype specification.
https://fontforge.org/docs/techref/non-standard.html#non-standard-bdf
the offset for previous BDF tag is 956, the length is 845.
the offset for FFTM tag is 8659, the length is 28.
because BDF table contains a string table, which is raw ASCII bytes. so it is hard to controll the 4 byte boundaries.
but seems fontforge do the byte alignment by itself as a whole.
so, I think, as many old "bimap embedded" trutype fonts exist, can we skip this boundary check? simple comment it out saves wqy-zenhei.ttc
The text was updated successfully, but these errors were encountered: