From 11a45262a4a4eef8cb6143c424f0588edbc429ff Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 14 Jun 2023 16:47:16 +0200 Subject: [PATCH] font-patcher: Add option to force patching in box drawing glyphs [why] When the original font designer's idea of cell height differs from the height we deduce the box drawing glyphs come out with the wrong size (if we do not touch them, for example because the font already has a complete set). [how] Add option that enforces patch-in of the box set. Signed-off-by: Fini Jastrow --- font-patcher | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/font-patcher b/font-patcher index 2ee80257ff..75dc958976 100755 --- a/font-patcher +++ b/font-patcher @@ -814,11 +814,11 @@ class font_patcher: box_enabled = self.source_monospaced and not self.symbolsonly # Box glyph only for monospaced and not for Symbols Only box_keep = False - if box_enabled: + if box_enabled or self.args.forcebox: self.sourceFont.selection.select(("ranges",), 0x2500, 0x259f) box_glyphs_target = len(list(self.sourceFont.selection)) box_glyphs_current = len(list(self.sourceFont.selection.byGlyphs)) - if box_glyphs_target > box_glyphs_current: + if box_glyphs_target > box_glyphs_current or self.args.forcebox: # Sourcefont does not have all of these glyphs, do not mix sets (overwrite existing) if box_glyphs_current > 0: logger.debug("%d/%d box drawing glyphs will be replaced", @@ -1890,14 +1890,15 @@ def setup_arguments(): parser.set_defaults(progressbars=True) parser.add_argument('--debug', dest='debugmode', default=0, type=int, nargs='?', help='Verbose mode (optional: 1=just to file; 2*=just to terminal; 3=display and file)', const=2, choices=range(0, 3 + 1)) parser.add_argument('--dry', dest='dry_run', default=False, action='store_true', help='Do neither patch nor store the font, to check naming') + parser.add_argument('--boxdrawing', dest='forcebox', default=False, action='store_true', help='Force patching in (over existing) box drawing glyphs') + parser.add_argument('--metrics', dest='metrics', default=None, choices=get_metrics_names(), help='Select vertical metrics source (for problematic cases)') + parser.add_argument('--name', dest='force_name', default=None, type=str, help='Specify naming source (\'full\', \'postscript\', or concrete free name-string)') parser.add_argument('--xavgcharwidth', dest='xavgwidth', default=None, type=int, nargs='?', help='Adjust xAvgCharWidth (optional: concrete value)', const=True) # --xavgcharwidth for compatibility with old applications like notepad and non-latin fonts # Possible values with examples: # - copy from sourcefont (default) # 0 - calculate from font according to OS/2-version-2 # 500 - set to 500 - parser.add_argument('--metrics', dest='metrics', default=None, choices=get_metrics_names(), help='Select vertical metrics source (for problematic cases)') - parser.add_argument('--name', dest='force_name', default=None, type=str, help='Specify naming source (\'full\', \'postscript\', or concrete free name-string)') # symbol fonts to include arguments sym_font_group = parser.add_argument_group('Symbol Fonts')