Skip to content

Commit

Permalink
Merge pull request #8 from aaronbell/main
Browse files Browse the repository at this point in the history
Extending character set and correcting backslash
  • Loading branch information
aaronbell authored May 2, 2022
2 parents 88c311d + e0b4666 commit 7a76a4c
Show file tree
Hide file tree
Showing 9 changed files with 30,534 additions and 27,754 deletions.
Binary file modified fonts/ttf/BIZUDMincho-Regular.ttf
Binary file not shown.
Binary file modified fonts/ttf/BIZUDPMincho-Regular.ttf
Binary file not shown.
19 changes: 3 additions & 16 deletions sources/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
TEMP = Path('temp')
EXPORT = Path('fonts/ttf')
SRC_IMPORT = Path("sources/extensions")
VERSION = "1.002"
VERSION = "1.05"

for font in IMPORT.glob("*.ttf"):

Expand Down Expand Up @@ -71,7 +71,6 @@
# Step 2 - Some metadata changes to align with GF expectations
# NAME table modifications
sourceTTF["name"].removeNames(platformID=1)
sourceTTF["name"].removeNames(nameID=6,platformID=3, langID=1041)

for platformID in [1033, 1041]:

Expand Down Expand Up @@ -99,6 +98,8 @@
sourceTTF["name"].setName("This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at: https://scripts.sil.org/OFL",13,3,1,platformID)
sourceTTF["name"].setName("https://scripts.sil.org/OFL",14,3,1,platformID)

sourceTTF["name"].removeNames(nameID=6,platformID=3, langID=1041)

# OS/2 Table modifications
sourceTTF["OS/2"].fsType = 0

Expand Down Expand Up @@ -151,20 +152,6 @@
newDSIG.signatureRecords = []
finalVersion.tables["DSIG"] = newDSIG

# Irritatingly, pyftmerge does not calculate the average character width correctly. It appears to simply average the xAvgCharWidth value in the two font files. However, given the heavy weighting of wider Japanese characters, we need to recalculate the average and insert it back into the font.

width_sum = 0
count = 0
for glyph_id in finalVersion['glyf'].glyphs: # At least .notdef must be present.
width = finalVersion['hmtx'].metrics[glyph_id][0]
# The OpenType spec doesn't exclude negative widths, but only positive
# widths seems to be the assumption in the wild?
if width > 0:
count += 1
width_sum += width

avgCharWidth = int(round(width_sum / count))
finalVersion["OS/2"].xAvgCharWidth = avgCharWidth

finalVersion.save(EXPORT / str(outputTTF).replace("BIZ-","BIZ"))

Expand Down
Loading

0 comments on commit 7a76a4c

Please sign in to comment.