diff options
author | jptrzy <jptrzy@gmail.com> | 2022-09-04 16:25:18 +0200 |
---|---|---|
committer | jptrzy <jptrzy@gmail.com> | 2022-09-04 16:25:18 +0200 |
commit | 184cefd1f76895a187c05638e9a830108af9d5c1 (patch) | |
tree | 9c825049df2f44781ef6252d6aa25efb0ed332cb | |
parent | 3534d7213afe10b67c1765258e625246961b71fc (diff) | |
download | neo-comic-mono-font-184cefd1f76895a187c05638e9a830108af9d5c1.tar.gz neo-comic-mono-font-184cefd1f76895a187c05638e9a830108af9d5c1.tar.bz2 neo-comic-mono-font-184cefd1f76895a187c05638e9a830108af9d5c1.zip |
It work's
-rw-r--r-- | generate.py | 26 | ||||
-rw-r--r-- | makefile | 10 |
2 files changed, 18 insertions, 18 deletions
diff --git a/generate.py b/generate.py index 7b5f545..c77e62b 100644 --- a/generate.py +++ b/generate.py @@ -2,15 +2,12 @@ # -*- coding: utf-8 -*- """ -Generates the Comic Mono font files based on Comic Shanns font. - -Required files: -- vendor/comic-shanns.otf -- vendor/Cousine-Regular.ttf +Generates the Neo Comic Mono font files based on Comic Shanns font. Based on: - monospacifier: https://github.com/cpitclaudel/monospacifier/blob/master/monospacifier.py - YosemiteAndElCapitanSystemFontPatcher: https://github.com/dtinth/YosemiteAndElCapitanSystemFontPatcher/blob/master/bin/patch + """ import os @@ -49,17 +46,16 @@ font.mergeFonts(new) ref = fontforge.open('vendor/cousine.ttf') -for g in font.glyphs(): - uni = g.unicode +for glyph in font.glyphs(): + uni = glyph.unicode category = unicodedata.category(chr(uni)) if 0 <= uni <= sys.maxunicode else None - if g.width > 0 and category not in ['Mn', 'Mc', 'Me']: - target_width = 510 - if g.width != target_width: - delta = target_width - g.width - g.left_side_bearing = int(delta / 2) - g.right_side_bearing = int(delta - g.left_side_bearing) - g.width = target_width - + if glyph.width > 0 and category not in ['Mn', 'Mc', 'Me']: + width = 510 + if glyph.width != width: + delta = width - glyph.width + glyph.left_side_bearing = int(round(glyph.left_side_bearing + delta / 2)) + glyph.right_side_bearing = int(round(glyph.right_side_bearing + delta - glyph.left_side_bearing)) + glyph.width = width font.familyname = 'Neo Comic Mono' @@ -11,13 +11,17 @@ main: install: main mkdir -p /usr/share/fonts/neo-comic cp build/* /usr/share/fonts/neo-comic - + +down: download + download: mkdir -p down vendor - wget https://www.ffonts.net/Cousin.font.zip -O down/cousin.zip + # wget https://www.ffonts.net/Cousin.font.zip -O down/cousin.zip + wget https://www.fontsquirrel.com/fonts/download/cousine -O down/cousin.zip unzip -u down/cousin.zip -d down - cp down/*.ttf vendor/cousine.ttf + cp down/*egular.ttf vendor/cousine.ttf wget https://github.com/shannpersand/comic-shanns/raw/master/v2/comic%20shanns.otf -O vendor/comic-shanns.otf + #wget https://github.com/shannpersand/comic-shanns/raw/master/v1/comic-shanns.otf -O vendor/comic-shanns.otf rm -rf down |