Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font-patcher: Allow glyphs with altuni for exactEncoding #793

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 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 = "3.0.4"
script_version = "3.0.5"

version = "2.2.1"
projectName = "Nerd Fonts"
Expand Down Expand Up @@ -939,6 +939,8 @@ class font_patcher:
if self.args.quiet is False:
sys.stdout.write("Adding " + str(max(1, glyphSetLength)) + " Glyphs from " + setName + " Set \n")

currentSourceFontGlyph = -1 # initialize for the exactEncoding case

for index, sym_glyph in enumerate(symbolFontSelection):
index = max(1, index)

Expand All @@ -948,8 +950,17 @@ class font_patcher:
sym_attr = attributes['default']

if exactEncoding:
# use the exact same hex values for the source font as for the symbol font
currentSourceFontGlyph = sym_glyph.encoding
# Use the exact same hex values for the source font as for the symbol font.
# Problem is we do not know the codepoint of the sym_glyph and because it
# came from a selection.byGlyphs there might be skipped over glyphs.
# The iteration is still in the order of the selection by codepoint,
# so we take the next allowed codepoint of the current glyph
possible_codes = [ ]
if sym_glyph.unicode > currentSourceFontGlyph:
possible_codes += [ sym_glyph.unicode ]
if sym_glyph.altuni:
possible_codes += [ v for v, s, r in sym_glyph.altuni if v > currentSourceFontGlyph ]
currentSourceFontGlyph = min(possible_codes)
else:
# use source font defined hex values based on passed in start and end
currentSourceFontGlyph = sourceFontList[sourceFontCounter]
Expand Down