Skip to content

Add support for unscaled fonts

Jeremy Soller requested to merge fschutt:master into master

Created by: fschutt

For https://github.com/fschutt/printpdf I would like to use rusttype. However, the problem is that in PDFs, you need to embed unscaled fonts. For this you need to embed a table where the vertical metrics of each Unicode character are listed. PDFs need the unscaled metrics. I referenced this problem shortly in https://github.com/fschutt/printpdf/issues/1.

Now I don't know if / how https://github.com/redox-os/stb_truetype-rs/pull/9 is of importance (because when I originally made PR https://github.com/redox-os/rusttype/pull/46 I needed to fix some other issues in order to get it working. However, these fixes (to stb_truetype) have nothing to do with rusttype itself and people could go ahead and use the new v_metrics_unscaled function independent of the that PR.

The reason I want this is because right now, only freetype allows me to get the raw, unscaled vertical metrics of glyphs. This causes problems when building for Windows and I'd like to get away from freetype as much as I can. However, I need to reliably be able to get the vertical metrics for this. Now that stb_truetype has been transferred, there may be more hope for this to actually work than a few months ago.

Merge request reports