Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
font-patcher: Resolve rounding error when rescaling
[why] The symbol glyphs are rescaled (when --mono is specified) so that they have a predefined width after insertion in the source font (to be patched font, called 'target font' below). Sometimes the width of the glyph after insertion is off a bit, like 0.2% or so. This seems strange, as we calculate the target width exactly. [how] As expected this are rounding errors. In the old code we take the original width of the glyph when it is in the symbol font and rescale it when it is in the target font. The width of the glyph should be the same in the source and the target font, right? It fact it is not, because the coordinate systems of the two fonts can (and usually are) different. fontforge's magic scales the glyph into the new coordinate system on insertion, such that it is approx the same as before. But when the coordinate system is integer based we get some small rounding errors just from copy and paste. To solve this, we - first copy the glyph from the source into the target font - then determine the glyphs width - then rescale the glyph to the target width Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
- Loading branch information