Last active
August 29, 2015 14:13
-
-
Save itiut/b988b8f5aeff690cbf83 to your computer and use it in GitHub Desktop.
IPAGothicのcurved quote (U+2018, U+2019, U+201C, U+201D)の幅を半角にする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fontforge | |
import os | |
import psMat | |
import shutil | |
import sys | |
def narrow_quotation_width(path): | |
f = fontforge.open(path) | |
# left quotation marks | |
for c in (0x2018, 0x201C): | |
g = f[c] | |
if g.width == 1000: | |
g.transform(psMat.translate(-500, 0)) | |
# right quotation marks | |
for c in (0x2019, 0x201D): | |
g = f[c] | |
if g.width == 1000: | |
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_quotation_width(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment