Last active
January 4, 2024 08:29
Revisions
-
h20y6m revised this gist
Jan 4, 2024 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ ref. https://h20y6m.github.io/posts/2023-12-02-texadvent2023/ # 使い方 1. [zrotfdump.pl](https://gist.github.com/zr-tex8r/2988601) を入手 -
h20y6m revised this gist
Nov 27, 2023 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,14 @@ mjn = int(m.group(2)) mjn2gid[mjn] = gid mjns = sorted(mjn2gid.keys()) mjnr = [] for mjn in mjns: if len(mjnr) > 0 and mjnr[len(mjnr)-1][1] == mjn - 1: mjnr[len(mjnr)-1][1] = mjn else: mjnr.append([mjn, mjn]) for dir in ['h', 'v']: with open(f'ipamjmm--{dir}.zvp', 'w') as f: def outvp(s): @@ -53,14 +61,22 @@ def outvp(s): outvp( ' (FONTDSIZE R 10.0)') outvp( ' )') outvp( '(CODESPACE') for [mjn1, mjn2] in mjnr: if mjn1 == mjn2: outvp(f' X{mjn1:X}') else: outvp(f' (CTRANGE H {mjn1:X} H {mjn2:X})') outvp( ' )') outvp( '(TYPE D 0') outvp( ' (CHARWD R 1.0)') outvp(f' (CHARHT R {charht})') outvp(f' (CHARDP R {chardp})') outvp( ' (MAP)') outvp( ' )') for mjn in mjns: gid = mjn2gid[mjn] outvp(f'(CHARACTER H {mjn:X}') outvp( ' (MAP') -
h20y6m revised this gist
Nov 27, 2023 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -14,3 +14,11 @@ $ python3 ipamjm.py $ jfmutil zvp2vf ipamjmm--h $ jfmutil zvp2vf ipamjmm--v ``` # メモ Windows の TeX Live に同梱されている perl を使うときは zrotfdump.pl の 41 行目をコメントアウトする。 ```pl #use Data::Dump 'dump'; ``` -
h20y6m created this gist
Nov 27, 2023 .There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # 使い方 1. [zrotfdump.pl](https://gist.github.com/zr-tex8r/2988601) を入手 2. zrotfdump.pl を使用して ipamjm.ttf からグリフ一覧を取得 ``` $ perl zrotfdump.pl name ipamjm.ttf > ipamjm-name.txt ``` 3. この ipamjm.py を使って ZVP ファイルを作成 ``` $ python3 ipamjm.py ``` 4. ZVP から VF/JFM を作成 ``` $ jfmutil zvp2vf ipamjmm--h $ jfmutil zvp2vf ipamjmm--v ``` This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ #!/usr/bin/env python3 import re IPAmjMinchoVersion = '006.01' mjn2gid = {} with open('ipamjm-name.txt') as f: for line in f: m = re.match(r'^(\d+)\tmj(\d+)$', line) if m: gid = int(m.group(1)) mjn = int(m.group(2)) mjn2gid[mjn] = gid for dir in ['h', 'v']: with open(f'ipamjmm--{dir}.zvp', 'w') as f: def outvp(s): f.write(s) f.write('\n') charht = '0.88' chardp = '0.12' if dir == 'v': charht = '0.5' chardp = '0.5' outvp( '(DIRECTION TATE)') outvp(f'(VTITLE IPAmjMincho{IPAmjMinchoVersion})') outvp( '(FAMILY IPAMJM KANJI)') outvp( '(FACE F MRR)') outvp( '(CODINGSCHEME TEX KANJI TEXT)') outvp( '(DESIGNSIZE R 10.0)') outvp( '(CHECKSUM O 0)') outvp( '(FONTDIMEN') outvp( ' (SLANT R 0.0)') outvp( ' (SPACE R 0.0)') outvp( ' (STRETCH R 0.1)') outvp( ' (SHRINK R 0.0)') outvp( ' (XHEIGHT R 1.0)') outvp( ' (QUAD R 1.0)') outvp( ' (EXTRASPACE R 0.25)') outvp( ' (EXTRASTRETCH R 0.2)') outvp( ' (EXTRASHRINK R 0.125)') outvp( ' )') outvp( '(MAPFONT D 0') outvp(f' (FONTNAME ipamjm-mzm-{dir})') outvp( ' (FONTCHECKSUM O 0)') outvp( ' (FONTAT R 1.0)') outvp( ' (FONTDSIZE R 10.0)') outvp( ' )') outvp( '(TYPE D 0') outvp( ' (CHARWD R 1.0)') outvp(f' (CHARHT R {charht})') outvp(f' (CHARDP R {chardp})') outvp( ' (MAP)') outvp( ' )') for mjn in sorted(mjn2gid.keys()): gid = mjn2gid[mjn] outvp(f'(CHARACTER H {mjn:X}') outvp( ' (MAP') outvp(f' (SETCHAR H {gid:X})') outvp( ' )') outvp( ' )')