Open mitchellh opened 2 years ago
Embedded PNGs in fonts! I had no idea, that's nasty :/ I agree we should fix this in the freetype bindings as you suggest.
In Mach itself, we're hoping to render glyphs ourselves on the GPU using freetype just to extract beziers - I was hoping we could use Noto too but I guess we'll need to find a fallback approach for whichever glyphs only have pre-rendered PNGs. Crazy.
Yeah Noto not only uses embedded PNGs, but they're fixed at a single resolution. Right now I'm putting them at full resolution into a texture atlas and downsampling in a shader, but I might move to downsampling a bit on the CPU since its a bit wasteful how large they are.
https://github.com/adobe-fonts/noto-emoji-svg looks interesting?
Maybe! I haven’t used SVG fonts yet, I’ve only read about them in the FT docs. I know that FT doesn’t include any SVG renderer but you can get the SVG data and probably pass that into a shader. Might be easier to just rasterize the SVG on CPU and then put that in a texture though.
I'm still using my own freetype zig fork for now and haven't had time to contribute (sorry!) but I ran into this and I think you will too. Some Emoji fonts such as Noto (Google) use embedded pngs which require freetype to be built with png support.
This is a bit of a can of worms so I'll explain it all here so you can avoid the footguns:
libpng
zlib
FT_CONFIG_OPTION_SYSTEM_ZLIB=1
for freetype and link in zlib that you used for step 2.libpng and zlib are both easy to build with Zig.
To test it all works, you'll need to load a glyph from a png font, Noto works well.