Skip to content

Instantly share code, notes, and snippets.

@itiut
Last active August 29, 2015 14:15
Show Gist options
  • Save itiut/0025d87c63238c8005cb to your computer and use it in GitHub Desktop.
Save itiut/0025d87c63238c8005cb to your computer and use it in GitHub Desktop.
IPAGothicのbox drawings (U+2500, U+2502, U+251C, U+2524, U+252C, U+2534, U+253C)の幅を半角にする
--- mig.d/scripts/migu.pe.orig 2015-02-23 13:57:25.685514516 +0900
+++ mig.d/scripts/migu.pe 2015-02-23 13:59:58.721992860 +0900
@@ -51,6 +51,7 @@
## delete some CJK ambiguous characters for merging
if ( (Strstr(file_in,"m-") > 1) || (Strstr(file_in,"mn-") > 1) )
+ # ─│├┤┬┴┼
# ´¨‖‘’“”
# °′″
# ΑΒΓΔΕΖΗΘ
@@ -72,6 +73,7 @@
# ±×÷§√‰†‡
# ¶№
del_glyph = [ \
+ 0u2500, 0u2502, 0u251c, 0u2524, 0u252c, 0u2534, 0u253c, \
0u00b4, 0u00a8, 0u2016, 0u2018, 0u2019, 0u201c, 0u201d, \
0u00b0, 0u2032, 0u2033, \
0u0391, 0u0392, 0u0393, 0u0394, 0u0395, 0u0396, 0u0397, 0u0398, \
# coding: utf-8
import fontforge
import os
import psMat
import shutil
import sys
def narrow_box_drawings_witdh(path):
f = fontforge.open(path)
# ─│├┤┬┴┼
for c in (0x2500, 0x2502, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C):
g = f[c]
if g.width == 1000:
g.transform(psMat.translate(-250, 0))
g.width = 500
f.save(path)
if __name__ == '__main__':
if len(sys.argv) < 2:
sys.exit('Usage: %s [font_file]...' % sys.argv[0])
for path in sys.argv[1:]:
dst = path + '.orig'
print('Copy: %s -> %s' % (path, dst))
shutil.copy(path, dst)
print('Modify: %s' % path)
narrow_box_drawings_witdh(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment