Skip to content

Commit

Permalink
Merge pull request #8692 from google/hotfix-nanummyeongjo
Browse files Browse the repository at this point in the history
[Nanum Myeongjo] Hotfixed fonts to add a space character
  • Loading branch information
emmamarichal authored Dec 11, 2024
2 parents 314ee0f + a43bf72 commit 08c68d8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Binary file modified ofl/nanummyeongjo/NanumMyeongjo-Bold.ttf
Binary file not shown.
Binary file modified ofl/nanummyeongjo/NanumMyeongjo-ExtraBold.ttf
Binary file not shown.
Binary file modified ofl/nanummyeongjo/NanumMyeongjo-Regular.ttf
Binary file not shown.
27 changes: 27 additions & 0 deletions ofl/nanummyeongjo/hotfix-space.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._g_l_y_f import Glyph
from bumpfontversion.sfnthandler import SFNTHandler
from bumpversion.version_part import VersionPart
import glob

h = SFNTHandler()

for font in glob.glob("*.ttf"):
ttfont = TTFont(font)
for table in ttfont["cmap"].tables:
if table.format == 4:
table.cmap[ord(" ")] = "space"
table.cmap[0xA0] = "space"
glyphs = ttfont.getGlyphOrder()
glyphs.append("space")
ttfont.setGlyphOrder(glyphs)

ttfont["glyf"].glyphs["space"] = Glyph()
ttfont["hmtx"].metrics["space"] = (1024, 0)

ttfont.save(font)

current_version = h.current_version(font)
current_version._values["minor"] = VersionPart("031")
h.set_version(font, current_version)

0 comments on commit 08c68d8

Please sign in to comment.