summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generate.py26
-rw-r--r--makefile10
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'
diff --git a/makefile b/makefile
index 00a85ca..ac066d5 100644
--- a/makefile
+++ b/makefile
@@ -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
Software created with 💖