Hello, no this isn’t corrupted and can be explained by taking a closer look reveals that the google font is most likely the original font which some of the glyphs are composed of multiple vector shapes. Like so:
The non-google version is simply a boolean union of the shapes creating a solid vector shape. When we bring in the original version into defold and setup the font as distance field(DF), Defold generates the DF font as a texture(s) and it does so by iterating over each of the glyphs shapes. With the highest font size of 118 defold results:
(DF texture)
(DF font result)
A fix could be to edit the font’s glyphs and boolean union the vector shapes manually before setting up the DF fonts in defold or use the non-original version that is already unioned.
Deeper Dive - notes:
I think there are actual issues with df font in Defold. Defold seems to generate the distance field texture from the generated font texture and the quality depends on the font “size” which in turn generates a certain texture size for that font. I believe there are ways to greatly improve this.
As Valve highlighted their technique in a paper from Siggraph 2007:
If we are able to generate the distance field texture from a temporary high resolution texture (discard the high res texture) then scale down the distance field texture using bicubic resampling we can get more low cost df texture and use that with a font texture that is independent from the df resolution and gain better quality & performance with the end results.
I see opportunity here to use valves technique using signed distance field in defold with more than just fonts if a shader was made for this and the developer provides their own textures and uses a quad to draw to for 2d or 3d model to take advantage of the sampler texture slots.
For testing purposes I created my own textures if anyone is interested.
- display texture
- High Res Signed distance field texture
- low res scaled (bicubic resampled) texture
question:
Quick look in the distance field fragment program seems to reference “SDF” ( Signed Distance Field )
But is defold using “signed” values? Both positive and negative values encoded in distance field? imagine crispy solid outlines.