Last active
August 21, 2019 08:22
-
-
Save zr-tex8r/06d4c37dde04fa8ac4146e6d60a71df2 to your computer and use it in GitHub Desktop.
kanji-config-updmap用のマップファイルを生成するスクリプト(手抜き)
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 characters
#!/usr/bin/env perl | |
# generate-fontmap family mincho-l.Xtf mincho-m.Xtf mincho-b.Xtf \ | |
# gothic-m.Xtf gothic-b.Xtf gothic-e.Xtf marugothic.Xtf | |
use strict; | |
($#ARGV == 7) or die "Wrong number of arguments"; | |
my ($fam, $mcl, $mcr, $mcb, $gtr, $gtb, $gte, $mgr) = @ARGV; | |
foreach my $fi (qw( | |
otf-hiragino.map | |
otf-up-hiragino.map | |
ptex-hiragino-04.map | |
ptex-hiragino.map | |
uptex-hiragino-04.map | |
uptex-hiragino.map | |
)) { | |
my $fo = $fi; $fo =~ s/hiragino/$fam/; | |
local $_ = `kpsewhich $fi`; chomp($_); | |
(-f $_) or die "File '$fi' not found"; | |
open(my $hi, '<', $_) or die; | |
open(my $ho, '>', $fo) or die; | |
while (<$hi>) { | |
m/hiraprop/ and last; | |
s/HiraMinPro-W2.otf/$mcl/g; | |
s/HiraMinPro-W3.otf/$mcr/g; | |
s/HiraMinPro-W6.otf/$mcb/g; | |
s/HiraKakuPro-W3.otf/$gtr/g; | |
s/HiraKakuPro-W6.otf/$gtb/g; | |
s/HiraKakuStd-W8.otf/$gte/g; | |
s/HiraMaruPro-W4.otf/$mgr/g; | |
print $ho ($_); | |
} | |
close($hi); close($ho); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment