Skip to content

Commit

Permalink
font-patcher: Add option to force patching in box drawing glyphs
Browse files Browse the repository at this point in the history
[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 <[email protected]>
  • Loading branch information
Finii committed Jun 14, 2023
1 parent f9e9677 commit 75dad55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 75dad55

Please sign in to comment.