Created
August 22, 2019 13:34
-
-
Save aminophen/85c53817de5fadd18d9537816e8ca449 to your computer and use it in GitHub Desktop.
OTF パッケージの otf-cjXX-X.tfm を作り直すパッチ
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
diff --git a/japanese-otf/makeotf b/japanese-otf/makeotf | |
index 7b134c9..4a828a6 100755 | |
--- a/japanese-otf/makeotf | |
+++ b/japanese-otf/makeotf | |
@@ -157,7 +157,8 @@ cp hminr-v.tfm tfm/hirakaku-w3-v.tfm | |
cp hminr-v.tfm tfm/hirakaku-w6-v.tfm | |
cp hminr-v.tfm tfm/hiramaru-w4-v.tfm | |
echo "making ofm file for dvipdfmx in CVS" | |
-perl script/mkcidofm.pl | |
+#perl script/mkcidofm.pl | |
+perl script/mkcidtfm.pl | |
perl script/mkpropofm.pl | |
#burasage | |
echo "making tfm/vf for burasage ..." | |
diff --git a/japanese-otf/script/mkcidtfm.pl b/japanese-otf/script/mkcidtfm.pl | |
new file mode 100644 | |
index 0000000..5d44f61 | |
--- /dev/null | |
+++ b/japanese-otf/script/mkcidtfm.pl | |
@@ -0,0 +1,115 @@ | |
+opendir(PLD, "pl") || mkdir("pl",0755) || die "cannot mkdir pl"; | |
+opendir(TFMD, "tfm") || mkdir("tfm",0755) || die "cannot mkdir tfm"; | |
+$font_at=1.0; | |
+@font_base_name=("cjmr", "cjgr", "cjmb", "cjgb", "cjmgr", "cjml", "cjge"); | |
+for ($d=0; $d<=1; $d++){ | |
+ if ($d==0){$dir="h";}elsif($d==1){$dir="v";} | |
+ @font_chartype_1=(); # 1/2 | |
+ @font_chartype_2=(); # 1/3 | |
+ @font_chartype_3=(); # 1/4 | |
+ open(PL, ">pl/otf-cjxx-$dir.pl") || die "cannot make file"; | |
+ print PL "(COMMENT THIS IS A KANJI FORMAT FILE)\n"; | |
+ print PL "(DIRECTION TATE)\n" if ($d==1); | |
+ print PL "(FAMILY HIRAMIN)\n"; | |
+ print PL "(FACE F MRR)\n"; | |
+ print PL "(CODINGSCHEME TEX KANJI TEXT)\n"; | |
+ print PL "(DESIGNSIZE R 10.0)\n"; | |
+ print PL "(COMMENT DESIGNSIZE IS IN POINTS)\n"; | |
+ print PL "(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)\n"; | |
+ print PL "(CHECKSUM H 0)\n"; | |
+ print PL "(SEVENBITSAFEFLAG FALSE)\n"; | |
+ print PL "(FONTDIMEN\n"; | |
+ print PL " (SLANT R 0.0)\n"; | |
+ print PL " (SPACE R 0.0)\n"; | |
+ print PL " (STRETCH R 0.0)\n"; | |
+ print PL " (SHRINK R 0.0)\n"; | |
+ printf PL " (XHEIGHT R %f)\n", $font_at; | |
+ printf PL " (QUAD R %f)\n", $font_at; | |
+ print PL " (EXTRASPACE R 0.0)\n"; | |
+ print PL " (EXTRASTRETCH R 0.0)\n"; | |
+ print PL " (EXTRASHRINK R 0.0)\n"; | |
+ print PL " )\n"; | |
+ for($cidcode=0; $cidcode<=23059; $cidcode++){ | |
+ if ($dir eq "h"){ | |
+ if (($cidcode >= 231) && ($cidcode <= 632)){ | |
+ $width=0.5; | |
+ }elsif(($cidcode == 8718) || ($cidcode == 8719)){ | |
+ $width=0.5; | |
+ }elsif((12063 <= $cidcode) && ($cidcode <= 12087)){ | |
+ $width=0.5; | |
+ }elsif((9738 <= $cidcode) && ($cidcode <= 9757)){ | |
+ $width=0.25; | |
+ }elsif((9758 <= $cidcode) && ($cidcode <= 9778)){ | |
+ $width=0.333333; | |
+ }else{$width=1.0;} | |
+ }elsif($dir eq "v"){ | |
+ if ((8950 <= $cidcode) && ($cidcode <= 9353)){ | |
+ $width=0.5; | |
+ }elsif((13254 <= $cidcode) && ($cidcode <= 13273)){ | |
+ $width=0.25; | |
+ }elsif((13274 <= $cidcode) && ($cidcode <= 13294)){ | |
+ $width=0.333333; | |
+ }else{$width=1.0;} | |
+ } | |
+ if ($width==0.5){ | |
+ push @font_chartype_1, "$cidcode"; | |
+ }elsif($width==0.333333){ | |
+ push @font_chartype_2, "$cidcode"; | |
+ }elsif($width==0.25){ | |
+ push @font_chartype_3, "$cidcode"; | |
+ } | |
+ } | |
+ if ($dir eq "h"){ | |
+ $accender=0.88; | |
+ $decender=0.12; | |
+ }elsif($dir eq "v"){ | |
+ $accender=0.5; | |
+ $decender=0.5; | |
+ } | |
+ # some of $cidcode are invalid when interpreted as JIS code | |
+ # so it fails 'valid_jis_code' test of pPLtoTF. | |
+ # upPLtoTF omits the test, so we can use it instead. | |
+ # charcodes are represented in U... (not J...) | |
+ # to make sure that we use upPLtoTF | |
+ print PL "(CHARSINTYPE D 1\n"; | |
+ foreach $cidcode(@font_chartype_1){ | |
+ printf PL " U%04X\n", $cidcode; | |
+ } | |
+ print PL " )\n"; | |
+ print PL "(CHARSINTYPE D 2\n"; | |
+ foreach $cidcode(@font_chartype_2){ | |
+ printf PL " U%04X\n", $cidcode; | |
+ } | |
+ print PL " )\n"; | |
+ print PL "(CHARSINTYPE D 3\n"; | |
+ foreach $cidcode(@font_chartype_3){ | |
+ printf PL " U%04X\n", $cidcode; | |
+ } | |
+ print PL " )\n"; | |
+ print PL "(TYPE D 0\n"; | |
+ printf PL " (CHARWD R %f)\n", 1.0*$font_at; | |
+ printf PL " (CHARHT R %f)\n", $font_at*$accender ; | |
+ printf PL " (CHARDP R %f)\n", $font_at*$decender; | |
+ print PL " )\n"; | |
+ print PL "(TYPE D 1\n"; | |
+ printf PL " (CHARWD R %f)\n", 0.5*$font_at; | |
+ printf PL " (CHARHT R %f)\n", $font_at*$accender ; | |
+ printf PL " (CHARDP R %f)\n", $font_at*$decender; | |
+ print PL " )\n"; | |
+ print PL "(TYPE D 2\n"; | |
+ printf PL " (CHARWD R %f)\n", 0.333333*$font_at; | |
+ printf PL " (CHARHT R %f)\n", $font_at*$accender ; | |
+ printf PL " (CHARDP R %f)\n", $font_at*$decender; | |
+ print PL " )\n"; | |
+ print PL "(TYPE D 3\n"; | |
+ printf PL " (CHARWD R %f)\n", 0.25*$font_at; | |
+ printf PL " (CHARHT R %f)\n", $font_at*$accender ; | |
+ printf PL " (CHARDP R %f)\n", $font_at*$decender; | |
+ print PL " )\n"; | |
+ close(PL); | |
+ foreach $base_name(@font_base_name){ | |
+ $font_name="otf-$base_name-$dir"; | |
+ # we use upPLtoTF instead of pPLtoTF (see comment above) | |
+ system("uppltotf pl/otf-cjxx-$dir.pl tfm/$font_name.tfm") | |
+ } | |
+} | |
diff --git a/japanese-otf/script/mktfm.pl b/japanese-otf/script/mktfm.pl | |
index ae0b82a..b0c1ade 100644 | |
--- a/japanese-otf/script/mktfm.pl | |
+++ b/japanese-otf/script/mktfm.pl | |
@@ -55,15 +55,15 @@ sub make_cid_tfm { | |
elsif ($l==2) {$lang="c";} elsif ($l==3){$lang="t";} | |
for ($i=0; $i<=1; $i++){#direction | |
if ($i==0) {$dir="h";}elsif ($i==1){$dir="v";} | |
- $varfilename="otf-cj$face-$dir"; | |
- open(DVIPSTFM,">tfm/$varfilename.tfm") || die "Can't make \'tfm/$varfilename.tfm\'!\n"; | |
- binmode(DVIPSTFM); | |
- if ($i==0) { | |
- foreach $binary(@dvips_tfm_h) {$_ = pack("C", $binary);print DVIPSTFM "$_";} | |
- }elsif ($i==1){ | |
- foreach $binary(@dvips_tfm_v) {$_ = pack("C", $binary);print DVIPSTFM "$_";} | |
- } | |
- close(DVIPSTFM); | |
+# $varfilename="otf-cj$face-$dir"; | |
+# open(DVIPSTFM,">tfm/$varfilename.tfm") || die "Can't make \'tfm/$varfilename.tfm\'!\n"; | |
+# binmode(DVIPSTFM); | |
+# if ($i==0) { | |
+# foreach $binary(@dvips_tfm_h) {$_ = pack("C", $binary);print DVIPSTFM "$_";} | |
+# }elsif ($i==1){ | |
+# foreach $binary(@dvips_tfm_v) {$_ = pack("C", $binary);print DVIPSTFM "$_";} | |
+# } | |
+# close(DVIPSTFM); | |
for ($first_hex=0x0; $first_hex <= 0x5; $first_hex++){ | |
$filename="cidj$face".sprintf("%x",$first_hex)."-$dir"; | |
open(TEXTFM,">tfm/$filename.tfm") || die "Can't make \'tfm/$filename.tfm\'!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
texjporg/japanese-otf-mirror#15 を参照。