From 75dad553afa4e75c91474dc2e4b4529e804bc485 Mon Sep 17 00:00:00 2001 From: Fini Jastrow <ulf.fini.jastrow@desy.de> 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 <ulf.fini.jastrow@desy.de> --- font-patcher | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/font-patcher b/font-patcher index 354492f393..1d9fa59ec0 100755 --- a/font-patcher +++ b/font-patcher @@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals # Change the script version when you edit this script: -script_version = "4.4.2" +script_version = "4.5.0" version = "3.0.2" projectName = "Nerd Fonts" @@ -794,11 +794,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", @@ -1877,6 +1877,7 @@ def setup_arguments(): # 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('--boxdrawing', dest='forcebox', default=False, action='store_true', help='Force patching in (over existing) box drawing glyphs') # symbol fonts to include arguments sym_font_group = parser.add_argument_group('Symbol Fonts')