font-patcher: Be explicit what shall be transformed

[why]
In the patch loop we use two methods to do something with the glyphs
- the glyph object directly (i.e. font[codepoint])
- a selection of glyphs in the font

Using the selection is a bit anonymous and depends on lines far away
(where the selection is set); direct glyph access seems to be easier
understood and is used almost everywhere.

Direct glyph access can not be used for copy() and paste(), but for
everything else.

[how]
The direct glyph addressing is already in use almost for everything, but
not for the transform() calls. This is changed.
Now we transform a specific glyph and not 'all selected glyphs' (with
selection = that specific glyph).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2021-12-22 15:00:39 +01:00
parent 355a7c55a8
commit 7e92302c12

View file

@ -776,7 +776,7 @@ class font_patcher:
if 'overlap' in sym_attr['params']:
scale_ratio_x *= 1 + sym_attr['params']['overlap']
scale_ratio_y *= 1 + sym_attr['params']['overlap']
self.sourceFont.transform(psMat.scale(scale_ratio_x, scale_ratio_y))
self.sourceFont[currentSourceFontGlyph].transform(psMat.scale(scale_ratio_x, scale_ratio_y))
# Use the dimensions from the newly pasted and stretched glyph
sym_dim = get_glyph_dimensions(self.sourceFont[currentSourceFontGlyph])
@ -807,7 +807,7 @@ class font_patcher:
x_align_distance += overlap_width
align_matrix = psMat.translate(x_align_distance, y_align_distance)
self.sourceFont.transform(align_matrix)
self.sourceFont[currentSourceFontGlyph].transform(align_matrix)
# Needed for setting 'advance width' on each glyph so they do not overlap,
# also ensures the font is considered monospaced on Windows by setting the