66from __future__ import absolute_import , print_function , unicode_literals
77
88# Change the script version when you edit this script:
9- script_version = "3.4.1 "
9+ script_version = "3.4.2 "
1010
1111version = "2.3.0-RC"
1212projectName = "Nerd Fonts"
@@ -776,6 +776,7 @@ class font_patcher:
776776 # Here one specific glyph is used as 'scale blueprint'. Other glyphs are
777777 # scaled by the same factor as this glyph. This is useful if you have one
778778 # 'biggest' glyph and all others should stay relatively in size.
779+ # Shifting in addition to scaling can be selected too (see below).
779780 # - ScaleGroups:
780781 # Here you specify a group of glyphs that should be handled together
781782 # with the same scaling and shifting. The basis for it is a 'combined
@@ -785,12 +786,14 @@ class font_patcher:
785786 # The ScaleGlyph method: You set 'ScaleGlyph' to the unicode of the reference glyph.
786787 # Note that there can be only one per patch-set.
787788 # Additionally you set 'GlyphsToScale' that contains all the glyphs that shall be
788- # handled like the reference glyph.
789+ # handled (scaled) like the reference glyph.
789790 # It is a List of: ((glyph code) or (tuple of two glyph codes that form a closed range))
790791 # 'GlyphsToScale': [
791792 # 0x0100, 0x0300, 0x0400, # The single glyphs 0x0100, 0x0300, and 0x0400
792793 # (0x0200, 0x0210), # All glyphs 0x0200 to 0x0210 including both 0x0200 and 0x0210
793794 # ]}
795+ # If you want to not only scale but also shift as the refenerce glyph you give the
796+ # data as 'GlyphsToScale+'. Note that only one set is used and the plus version is preferred.
794797 #
795798 # For the ScaleGroup method you define any number groups of glyphs and each group is
796799 # handled separately. The combined bounding box of all glyphs in the group is determined
@@ -1324,7 +1327,13 @@ class font_patcher:
13241327 if 'ScaleGlyph' in scaleRules :
13251328 # Rewrite to equivalent ScaleGroup
13261329 group_list = []
1327- for i in scaleRules ['GlyphsToScale' ]:
1330+ if 'GlyphsToScale+' in scaleRules :
1331+ key = 'GlyphsToScale+'
1332+ plus = True
1333+ else :
1334+ key = 'GlyphsToScale'
1335+ plus = False
1336+ for i in scaleRules [key ]:
13281337 if isinstance (i , tuple ):
13291338 group_list .append (range (i [0 ], i [1 ] + 1 ))
13301339 else :
@@ -1333,7 +1342,10 @@ class font_patcher:
13331342 scale = self .get_scale_factors (sym_dim , 'pa' )[0 ]
13341343 scaleRules ['ScaleGroups' ].append (group_list )
13351344 scaleRules ['scales' ].append (scale )
1336- scaleRules ['bbdims' ].append (None ) # The 'old' style keeps just the scale, not the positioning
1345+ if plus :
1346+ scaleRules ['bbdims' ].append (sym_dim )
1347+ else :
1348+ scaleRules ['bbdims' ].append (None ) # The 'old' style keeps just the scale, not the positioning
13371349
13381350 def get_glyph_scale (self , symbol_unicode , scaleRules , symbolFont , dest_unicode ):
13391351 """ Determines whether or not to use scaled glyphs for glyph in passed symbol_unicode """
0 commit comments