-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
Currently, attempting to use glyphs from fonts that have the raster image type other than PNG panics with:
failed to decode image (Format error decoding Png: Invalid PNG signature.)
in draw_raster_glyph, because it assumes every color glyph has the image type PNG.
I'm not exactly sure what these fonts are called, as FontForge refuses to open it, because its name isn't ASCII 🙃
I made a patch to at least add support for BitmapMonoPacked (the type of glyphs in SimSun) in Nerixyz@4188128, however I don't think that's the correct approach. Since the bitmap is monochrome, it should be fine to color it (→ it should be rendered as a "regular" glyph in render_text). Since I'm new to the codebase, I wanted to ask where I should add support for the monochrome glyphs.
Use Case
At least on Windows, Typst falls back to the SimSun font for Chinese characters. When rendering to PNG, Typst currently panics (not really a compiler bug, I'd say, more like a missing feature).
For example, a Typst file having just 年 compiled as PNG will panic on Windows.