| 1 |
#!/usr/bin/env perl |
| 2 |
# |
| 3 |
# kanji-fontmap-creator |
| 4 |
# (c) 2012-2014 Norbert Preining |
| 5 |
# Version: 20210625.0 |
| 6 |
# Licenced under the GPLv2 or any higher version |
| 7 |
# |
| 8 |
# gui to create map files for (kanji-config-)updmap |
| 9 |
# |
| 10 |
# ptex/uptex: |
| 11 |
# 2 fonts (rml/gbm) |
| 12 |
# 2 variants |
| 13 |
# (ev vertical/horizontal) |
| 14 |
# |
| 15 |
# otf/otf-up: |
| 16 |
# |
| 17 |
# 2 variants |
| 18 |
# fonts: |
| 19 |
# gothic: regular, bold, heavy, maru |
| 20 |
# mincho: regular, bold, light |
| 21 |
# |
| 22 |
# possible improvements: |
| 23 |
# - allow editing current files by reading and interpreting them |
| 24 |
# needs better structure of the data |
| 25 |
# - specify output directory, automatically write to $TEXMFLOCAL ? |
| 26 |
# - more checks, warnings? |
| 27 |
# |
| 28 |
|
| 29 |
$^W = 1; |
| 30 |
use strict; |
| 31 |
|
| 32 |
use Tk; |
| 33 |
use Tk::NoteBook; |
| 34 |
use Tk::Dialog; |
| 35 |
use Cwd; |
| 36 |
use Getopt::Long qw(:config no_autoabbrev); |
| 37 |
use Pod::Usage; |
| 38 |
|
| 39 |
my $opt_lang = "en"; |
| 40 |
my $opt_help = 0; |
| 41 |
my $opt_version = 0; |
| 42 |
|
| 43 |
my $prg = "kanji-fontmap-creator"; |
| 44 |
my $version = "20210625.0"; |
| 45 |
|
| 46 |
# |
| 47 |
# global vars configuring operation |
| 48 |
my $group_name = ""; |
| 49 |
my $do_vertical = 0; |
| 50 |
my $do_iso2004 = 0; |
| 51 |
my $do_otf = 0; |
| 52 |
my @f_mincho_regular; my @f_gothic_regular; |
| 53 |
my @f_mincho_bold; my @f_gothic_bold; |
| 54 |
my @f_gothic_heavy; |
| 55 |
my @f_gothic_maru; |
| 56 |
my @f_mincho_light; |
| 57 |
my $b_save; |
| 58 |
|
| 59 |
my $iso_i = 1; |
| 60 |
my $vert_i = 2; |
| 61 |
my $isovert_i = 3; |
| 62 |
my @order; |
| 63 |
|
| 64 |
my $mw; |
| 65 |
|
| 66 |
$order[0] = 'Default'; |
| 67 |
$order[$iso_i] = 'ISO2004'; |
| 68 |
$order[$vert_i] = 'Vertical'; |
| 69 |
$order[$isovert_i] = 'ISO2004/Vertical'; |
| 70 |
|
| 71 |
|
| 72 |
GetOptions( |
| 73 |
"lang=s" => \$opt_lang, |
| 74 |
"version" => \$opt_version, |
| 75 |
"help|?|h" => \$opt_help) or pod2usage(1); |
| 76 |
|
| 77 |
if (win32()) { |
| 78 |
pod2usage(-exitstatus => 0, |
| 79 |
-verbose => 2, |
| 80 |
-noperldoc => 1, |
| 81 |
-output => \*STDOUT) if $opt_help; |
| 82 |
} else { |
| 83 |
pod2usage(-exitstatus => 0, -verbose => 2, -file => $0) if $opt_help; |
| 84 |
} |
| 85 |
|
| 86 |
if ($opt_version) { |
| 87 |
print "$prg $version\n"; |
| 88 |
exit 0; |
| 89 |
} |
| 90 |
|
| 91 |
if ($opt_lang ne "en") { |
| 92 |
print STDERR "$prg: languages other than en currently not implemented.\n"; |
| 93 |
} |
| 94 |
|
| 95 |
&main(); |
| 96 |
|
| 97 |
sub main { |
| 98 |
# |
| 99 |
# |
| 100 |
$mw = MainWindow->new; |
| 101 |
$mw->title("Kanji Fontmap Creator"); |
| 102 |
$mw->optionAdd("*Button.Relief", "ridge", 20); |
| 103 |
my $tf = $mw->Frame; |
| 104 |
my $nb = $mw->NoteBook; |
| 105 |
my $bf = $mw->Frame; |
| 106 |
# |
| 107 |
# top frame |
| 108 |
# |
| 109 |
my $name_label = $tf->Label(-text => "Group name:"); |
| 110 |
my $name_entry = $tf->Entry(-width => 30, -textvariable => \$group_name, |
| 111 |
-validate => "all", -validatecommand => \&validate_group_name); |
| 112 |
my $opt_label = $tf->Label(-text => "Options:"); |
| 113 |
my $opt_vert = $tf->Checkbutton(-text => "separate vertical fonts", |
| 114 |
-variable => \$do_vertical); |
| 115 |
my $opt_iso = $tf->Checkbutton(-text => "separate ISO 2004 support", |
| 116 |
-variable => \$do_iso2004 ); |
| 117 |
my $opt_otf = $tf->Checkbutton(-text => "OTF support", |
| 118 |
-variable => \$do_otf); |
| 119 |
# |
| 120 |
# pack the stuff |
| 121 |
$name_label->grid(-row => 0, -column => 0, -sticky => "e"); |
| 122 |
$name_entry->grid(-row => 0, -column => 1, -sticky => "w"); |
| 123 |
$opt_label->grid(-row => 1, -column => 0, -sticky => "e"); |
| 124 |
$opt_otf->grid(-row => 1, -column => 1, -sticky => "w"); |
| 125 |
$opt_iso->grid(-column => 1, -sticky => "w"); |
| 126 |
$opt_vert->grid(-column => 1, -sticky => "w"); |
| 127 |
# |
| 128 |
# notebook part |
| 129 |
my @p; |
| 130 |
for my $i (0..$#order) { |
| 131 |
$p[$i] = $nb->add($order[$i], -label => $order[$i], |
| 132 |
-state => ($i > 0 ? "disabled" : "normal")); |
| 133 |
} |
| 134 |
# |
| 135 |
# pack outer window |
| 136 |
$tf->pack(-expand => 1, -fill => 'x', -padx => '4m', -pady => '4m'); |
| 137 |
$nb->pack(-expand => 1, -fill => 'both', -padx => '4m'); |
| 138 |
$bf->pack(-expand => 1, -fill => 'x', -padx => '4m', -pady => '4m'); |
| 139 |
# |
| 140 |
# |
| 141 |
my @l_mincho; my @l_gothic; |
| 142 |
my @l_regular; |
| 143 |
my @l_bold; |
| 144 |
my @l_heavy; |
| 145 |
my @l_light; |
| 146 |
my @l_maru; |
| 147 |
my @e_mincho_regular; my @e_gothic_regular; |
| 148 |
my @e_mincho_bold; my @e_gothic_bold; |
| 149 |
my @e_gothic_heavy; |
| 150 |
my @e_gothic_maru; |
| 151 |
my @e_mincho_light; |
| 152 |
my $ew = 20; |
| 153 |
for my $i (0..$#order) { |
| 154 |
$l_mincho[$i] = $p[$i]->Label(-text => "Mincho"); |
| 155 |
$l_gothic[$i] = $p[$i]->Label(-text => "Gothic"); |
| 156 |
# |
| 157 |
$l_regular[$i] = $p[$i]->Label(-text => "Regular"); |
| 158 |
$e_mincho_regular[$i] = $p[$i]->Entry(-width => $ew, |
| 159 |
-textvariable => \$f_mincho_regular[$i]); |
| 160 |
$e_gothic_regular[$i] = $p[$i]->Entry(-width => $ew, |
| 161 |
-textvariable => \$f_gothic_regular[$i]); |
| 162 |
# |
| 163 |
$l_bold[$i] = $p[$i]->Label(-text => "Bold", -state => "disabled"); |
| 164 |
$e_mincho_bold[$i] = $p[$i]->Entry(-width => $ew, |
| 165 |
-textvariable => \$f_mincho_bold[$i], |
| 166 |
-state => "disabled", -relief => "flat"); |
| 167 |
$e_gothic_bold[$i] = $p[$i]->Entry(-width => $ew, |
| 168 |
-textvariable => \$f_gothic_bold[$i], |
| 169 |
-state => "disabled", -relief => "flat"); |
| 170 |
# |
| 171 |
$l_heavy[$i] = $p[$i]->Label(-text => "Heavy", -state => "disabled"); |
| 172 |
$l_light[$i] = $p[$i]->Label(-text => "Light", -state => "disabled"); |
| 173 |
$l_maru[$i] = $p[$i]->Label(-text => "Maru", -state => "disabled"); |
| 174 |
$e_gothic_heavy[$i] = $p[$i]->Entry(-width => $ew, |
| 175 |
-textvariable => \$f_gothic_heavy[$i], |
| 176 |
-state => "disabled", -relief => "flat"); |
| 177 |
$e_gothic_maru[$i] = $p[$i]->Entry(-width => $ew, |
| 178 |
-textvariable => \$f_gothic_maru[$i], |
| 179 |
-state => "disabled", -relief => "flat"); |
| 180 |
$e_mincho_light[$i] = $p[$i]->Entry(-width => $ew, |
| 181 |
-textvariable => \$f_mincho_light[$i], |
| 182 |
-state => "disabled", -relief => "flat"); |
| 183 |
# |
| 184 |
# grid the whole stuff |
| 185 |
$l_mincho[$i]->grid(-row => 0, -column => 1); |
| 186 |
$l_gothic[$i]->grid(-row => 0, -column => 2); |
| 187 |
# |
| 188 |
$l_regular[$i]->grid(-row => 1, -column => 0, -sticky => "e"); |
| 189 |
$e_mincho_regular[$i]->grid(-row => 1, -column => 1); |
| 190 |
$e_gothic_regular[$i]->grid(-row => 1, -column => 2); |
| 191 |
# |
| 192 |
$l_bold[$i]->grid(-row => 3, -column => 0, -sticky => "e"); |
| 193 |
$e_mincho_bold[$i]->grid(-row => 3, -column => 1); |
| 194 |
$e_gothic_bold[$i]->grid(-row => 3, -column => 2); |
| 195 |
# |
| 196 |
$l_heavy[$i]->grid(-row => 4, -column => 0, -sticky => "e"); |
| 197 |
$e_gothic_heavy[$i]->grid(-row => 4, -column => 1); |
| 198 |
$l_maru[$i]->grid(-row => 5, -column => 0, -sticky => "e"); |
| 199 |
$e_gothic_maru[$i]->grid(-row => 5, -column => 2); |
| 200 |
$l_light[$i]->grid(-row => 6, -column => 0, -sticky => "e"); |
| 201 |
$e_mincho_light[$i]->grid(-row => 6, -column => 2); |
| 202 |
} |
| 203 |
# |
| 204 |
# Button frame |
| 205 |
$b_save = $bf->Button(-text => "Save"); |
| 206 |
|
| 207 |
# |
| 208 |
# Actions: |
| 209 |
# |
| 210 |
# activate tabs when options are selected |
| 211 |
$opt_vert->configure(-command => sub { |
| 212 |
if (!$do_vertical && ($nb->raised() =~ m/Vertical/)) { |
| 213 |
$nb->raise("Default"); |
| 214 |
} |
| 215 |
$nb->pageconfigure("Vertical", |
| 216 |
-state => ($do_vertical ? "normal" : "disabled")); |
| 217 |
$nb->pageconfigure("ISO2004/Vertical", |
| 218 |
-state => (($do_vertical & $do_iso2004) ? "normal" : "disabled")) |
| 219 |
}); |
| 220 |
$opt_iso->configure(-command => sub { |
| 221 |
if (!$do_iso2004 && ($nb->raised() =~ m/ISO2004/)) { |
| 222 |
$nb->raise("Default"); |
| 223 |
} |
| 224 |
$nb->pageconfigure("ISO2004", |
| 225 |
-state => ($do_iso2004 ? "normal" : "disabled")); |
| 226 |
$nb->pageconfigure("ISO2004/Vertical", |
| 227 |
-state => (($do_vertical & $do_iso2004) ? "normal" : "disabled")) |
| 228 |
}); |
| 229 |
|
| 230 |
# activate lower part for when otf is selected |
| 231 |
$opt_otf->configure(-command => sub { |
| 232 |
for my $i (0..$#order) { |
| 233 |
$l_light[$i]->configure( |
| 234 |
-state => ($do_otf ? "normal" : "disabled")); |
| 235 |
$e_mincho_light[$i]->configure( |
| 236 |
-state => ($do_otf ? "normal" : "disabled"), |
| 237 |
-relief => ($do_otf ? "sunken" : "flat")); |
| 238 |
# |
| 239 |
$l_bold[$i]->configure( |
| 240 |
-state => ($do_otf ? "normal" : "disabled")); |
| 241 |
$e_mincho_bold[$i]->configure( |
| 242 |
-state => ($do_otf ? "normal" : "disabled"), |
| 243 |
-relief => ($do_otf ? "sunken" : "flat")); |
| 244 |
$e_gothic_bold[$i]->configure( |
| 245 |
-state => ($do_otf ? "normal" : "disabled"), |
| 246 |
-relief => ($do_otf ? "sunken" : "flat")); |
| 247 |
# |
| 248 |
$l_heavy[$i]->configure( |
| 249 |
-state => ($do_otf ? "normal" : "disabled")); |
| 250 |
$l_maru[$i]->configure( |
| 251 |
-state => ($do_otf ? "normal" : "disabled")); |
| 252 |
$e_gothic_maru[$i]->configure( |
| 253 |
-state => ($do_otf ? "normal" : "disabled"), |
| 254 |
-relief => ($do_otf ? "sunken" : "flat")); |
| 255 |
$e_gothic_heavy[$i]->configure( |
| 256 |
-state => ($do_otf ? "normal" : "disabled"), |
| 257 |
-relief => ($do_otf ? "sunken" : "flat")); |
| 258 |
} |
| 259 |
}); |
| 260 |
# |
| 261 |
# |
| 262 |
$b_save->configure(-command => \&export_font_maps, -state => "disabled"); |
| 263 |
$b_save->pack; |
| 264 |
|
| 265 |
Tk::MainLoop(); |
| 266 |
} |
| 267 |
|
| 268 |
sub validate_group_name { |
| 269 |
my ($new_val, undef, $old_val) = @_; |
| 270 |
$b_save->configure(-state => ($new_val eq "" ? "disabled" : "normal")); |
| 271 |
return 1; |
| 272 |
} |
| 273 |
|
| 274 |
sub addgroup { |
| 275 |
my ($str, $fref, $i_a, $i_b, @entries) = @_; |
| 276 |
my $do = 1; |
| 277 |
while (@entries) { |
| 278 |
my $tfm = shift @entries; |
| 279 |
my $enc = shift @entries; |
| 280 |
addlines($str, $tfm, $enc, ($do ? $fref->[$i_a] : $fref->[$i_b])); |
| 281 |
$do = !$do; |
| 282 |
} |
| 283 |
} |
| 284 |
|
| 285 |
sub addlines { |
| 286 |
my ($strref, @entries) = @_; |
| 287 |
while (@entries) { |
| 288 |
my $tfm = shift @entries; |
| 289 |
my $enc = shift @entries; |
| 290 |
my $fn = shift @entries; |
| 291 |
if (defined($fn)) { |
| 292 |
$$strref .= "$tfm $enc $fn\n"; |
| 293 |
} else { |
| 294 |
print STDERR "target file for $tfm $enc not defined!\n"; |
| 295 |
} |
| 296 |
} |
| 297 |
} |
| 298 |
|
| 299 |
sub export_font_maps { |
| 300 |
if ($group_name eq "") { |
| 301 |
print STDERR "That should not happen!\n"; |
| 302 |
exit 1; |
| 303 |
} |
| 304 |
|
| 305 |
# indirections |
| 306 |
my $ii = ($do_iso2004 ? $iso_i : 0); |
| 307 |
my $vi = ($do_vertical ? $vert_i : 0); |
| 308 |
my $ivi = (($do_vertical && $do_vertical) ? $isovert_i : 0); |
| 309 |
# |
| 310 |
|
| 311 |
my ($ptexlines, $ptex04lines, $uptexlines, $uptex04lines); |
| 312 |
my ($otflines, $otfuplines); |
| 313 |
addlines(\$ptexlines, |
| 314 |
'rml', 'H', $f_mincho_regular[0], |
| 315 |
'rmlv','V', $f_mincho_regular[$vi], |
| 316 |
'gbm', 'H', $f_gothic_regular[0], |
| 317 |
'gbmv','V', $f_gothic_regular[$vi]); |
| 318 |
addlines(\$ptex04lines, |
| 319 |
'rml', 'H', $f_mincho_regular[$ii], |
| 320 |
'rmlv','V', $f_mincho_regular[$ivi], |
| 321 |
'gbm', 'H', $f_gothic_regular[$ii], |
| 322 |
'gbmv','V', $f_gothic_regular[$ivi]); |
| 323 |
addlines(\$uptexlines, |
| 324 |
'urml', 'UniJIS-UTF16-H', $f_mincho_regular[0], |
| 325 |
'urmlv', 'UniJIS-UTF16-V', $f_mincho_regular[$vi], |
| 326 |
'ugbm', 'UniJIS-UTF16-H', $f_gothic_regular[0], |
| 327 |
'ugbmv', 'UniJIS-UTF16-V', $f_gothic_regular[$vi], |
| 328 |
'uprml-h', 'UniJIS-UTF16-H', $f_mincho_regular[0], |
| 329 |
'uprml-v', 'UniJIS-UTF16-V', $f_mincho_regular[$vi], |
| 330 |
'upgbm-h', 'UniJIS-UTF16-H', $f_gothic_regular[0], |
| 331 |
'upgbm-v', 'UniJIS-UTF16-V', $f_gothic_regular[$vi], |
| 332 |
'uprml-hq', 'UniJIS-UCS2-H', $f_mincho_regular[0], |
| 333 |
'upgbm-hq', 'UniJIS-UCS2-H', $f_gothic_regular[0]); |
| 334 |
addlines(\$uptex04lines, |
| 335 |
'urml', 'UniJIS-UTF16-H', $f_mincho_regular[$ii], |
| 336 |
'urmlv', 'UniJIS-UTF16-V', $f_mincho_regular[$ivi], |
| 337 |
'ugbm', 'UniJIS-UTF16-H', $f_gothic_regular[$ii], |
| 338 |
'ugbmv', 'UniJIS-UTF16-V', $f_gothic_regular[$ivi], |
| 339 |
'uprml-h', 'UniJIS-UTF16-H', $f_mincho_regular[$ii], |
| 340 |
'uprml-v', 'UniJIS-UTF16-V', $f_mincho_regular[$ivi], |
| 341 |
'upgbm-h', 'UniJIS-UTF16-H', $f_gothic_regular[$ii], |
| 342 |
'upgbm-v', 'UniJIS-UTF16-V', $f_gothic_regular[$ivi], |
| 343 |
'uprml-hq', 'UniJIS-UCS2-H', $f_mincho_regular[$ii], |
| 344 |
'upgbm-hq', 'UniJIS-UCS2-H', $f_gothic_regular[$ii]); |
| 345 |
|
| 346 |
|
| 347 |
addlines(\$otflines, |
| 348 |
'%', 'mincho regular', '', |
| 349 |
'otf-ujmr-h', 'UniJIS-UTF16-H', $f_mincho_regular[0], |
| 350 |
'otf-ujmr-v', 'UniJIS-UTF16-V', $f_mincho_regular[$vi], |
| 351 |
'otf-cjmr-h', 'Identity-H', $f_mincho_regular[0], |
| 352 |
'otf-cjmr-v', 'Identity-V', $f_mincho_regular[$vi], |
| 353 |
'hminr-h', 'H', $f_mincho_regular[0], |
| 354 |
'hminr-v', 'V', $f_mincho_regular[$vi], |
| 355 |
'%', 'gothic regular', '', |
| 356 |
'otf-ujgr-h', 'UniJIS-UTF16-H', $f_gothic_regular[0], |
| 357 |
'otf-ujgr-v', 'UniJIS-UTF16-V', $f_gothic_regular[$vi], |
| 358 |
'otf-cjgr-h', 'Identity-H', $f_gothic_regular[0], |
| 359 |
'otf-cjgr-v', 'Identity-V', $f_gothic_regular[$vi], |
| 360 |
'hgothr-h', 'H', $f_gothic_regular[0], |
| 361 |
'hgothr-v', 'V', $f_gothic_regular[$vi], |
| 362 |
'%', 'mincho bold', ''); |
| 363 |
addgroup(\$otflines, ($do_otf ? \@f_mincho_bold : \@f_mincho_regular), |
| 364 |
0, $vi, |
| 365 |
'otf-ujmb-h', 'UniJIS-UTF16-H', |
| 366 |
'otf-ujmb-v', 'UniJIS-UTF16-V', |
| 367 |
'otf-cjmb-h', 'Identity-H', |
| 368 |
'otf-cjmb-v', 'Identity-V', |
| 369 |
'hminb-h', 'H', |
| 370 |
'hminb-v', 'V'); |
| 371 |
addlines(\$otflines, '%', 'gothic bold', ''); |
| 372 |
addgroup(\$otflines, ($do_otf ? \@f_gothic_bold : \@f_gothic_regular), |
| 373 |
0, $vi, |
| 374 |
'otf-ujgb-h', 'UniJIS-UTF16-H', |
| 375 |
'otf-ujgb-v', 'UniJIS-UTF16-V', |
| 376 |
'otf-cjgb-h', 'Identity-H', |
| 377 |
'otf-cjgb-v', 'Identity-V', |
| 378 |
'hgothb-h', 'H', |
| 379 |
'hgothb-v', 'V'); |
| 380 |
addlines(\$otflines, '%', 'gothic heavy', ''); |
| 381 |
addgroup(\$otflines, ($do_otf ? \@f_gothic_heavy : \@f_gothic_regular), |
| 382 |
0, $vi, |
| 383 |
'hgotheb-h', 'H', |
| 384 |
'hgotheb-v', 'V'); |
| 385 |
addlines(\$otflines, '%', 'gothic maru', ''); |
| 386 |
addgroup(\$otflines, ($do_otf ? \@f_gothic_maru : \@f_gothic_regular), |
| 387 |
0, $vi, |
| 388 |
'otf-ujmgr-h', 'UniJIS-UTF16-H', |
| 389 |
'otf-ujmgr-v', 'UniJIS-UTF16-V', |
| 390 |
'otf-cjmgr-h', 'Identity-H', |
| 391 |
'otf-cjmgr-v', 'Identity-V', |
| 392 |
'hmgothr-h', 'H', |
| 393 |
'hmgothr-v', 'V'); |
| 394 |
addlines(\$otflines, '%', 'mincho light', ''); |
| 395 |
addgroup(\$otflines, ($do_otf ? \@f_mincho_light : \@f_mincho_regular), |
| 396 |
0, $vi, |
| 397 |
'otf-ujml-h', 'UniJIS-UTF16-H', |
| 398 |
'otf-ujml-v', 'UniJIS-UTF16-V', |
| 399 |
'otf-cjml-h', 'Identity-H', |
| 400 |
'otf-cjml-v', 'Identity-V', |
| 401 |
'hminl-h', 'H', |
| 402 |
'hminl-v', 'V'); |
| 403 |
addlines(\$otflines, '%', 'JIS 2004', '', |
| 404 |
'otf-ujmrn-h', 'UniJIS2004-UTF16-H', $f_mincho_regular[$ii], |
| 405 |
'otf-ujmrn-v', 'UniJIS2004-UTF16-V', $f_mincho_regular[$ivi], |
| 406 |
'hminrn-h', 'H', $f_mincho_regular[$ii], |
| 407 |
'hminrn-v', 'V', $f_mincho_regular[$ivi], |
| 408 |
'%', '', '', |
| 409 |
'otf-ujgrn-h', 'UniJIS2004-UTF16-H', $f_gothic_regular[$ii], |
| 410 |
'otf-ujgrn-v', 'UniJIS2004-UTF16-V', $f_gothic_regular[$ivi], |
| 411 |
'hgothrn-h', 'H' , $f_gothic_regular[$ii], |
| 412 |
'hgothrn-v', 'V' , $f_gothic_regular[$ivi], |
| 413 |
'%', '', ''); |
| 414 |
addgroup(\$otflines, ($do_otf ? \@f_mincho_bold : \@f_mincho_regular), |
| 415 |
$ii, $ivi, |
| 416 |
'otf-ujmbn-h', 'UniJIS2004-UTF16-H', |
| 417 |
'otf-ujmbn-v', 'UniJIS2004-UTF16-V', |
| 418 |
'hminbn-h', 'H', |
| 419 |
'hminbn-v', 'V'); |
| 420 |
addlines(\$otflines, '%', '', ''); |
| 421 |
addgroup(\$otflines, ($do_otf ? \@f_gothic_bold : \@f_gothic_regular), |
| 422 |
$ii, $ivi, |
| 423 |
'otf-ujgbn-h', 'UniJIS2004-UTF16-H', |
| 424 |
'otf-ujgbn-v', 'UniJIS2004-UTF16-V', |
| 425 |
'hgothbn-h', 'H', |
| 426 |
'hgothbn-v', 'V'); |
| 427 |
addlines(\$otflines, '%', '', ''); |
| 428 |
addgroup(\$otflines, ($do_otf ? \@f_gothic_heavy : \@f_gothic_regular), |
| 429 |
$ii, $ivi, |
| 430 |
'otf-ujmgrn-h', 'UniJIS2004-UTF16-H', |
| 431 |
'otf-ujmgrn-v', 'UniJIS2004-UTF16-V', |
| 432 |
'hmgothrn-h', 'H', |
| 433 |
'hmgothrn-v', 'V'); |
| 434 |
addlines(\$otflines, '%', '', ''); |
| 435 |
addgroup(\$otflines, ($do_otf ? \@f_mincho_light : \@f_mincho_regular), |
| 436 |
$ii, $ivi, |
| 437 |
'otf-ujmln-h', 'UniJIS2004-UTF16-H', |
| 438 |
'otf-ujmln-v', 'UniJIS2004-UTF16-V', |
| 439 |
'hminln-h', 'H', |
| 440 |
'hminln-v', 'V'); |
| 441 |
|
| 442 |
addlines(\$otfuplines, |
| 443 |
'uphminr-h', 'UniJIS-UTF16-H', $f_mincho_regular[0], |
| 444 |
'uphminr-v', 'UniJIS-UTF16-V', $f_mincho_regular[$vi], |
| 445 |
'uphgothr-h', 'UniJIS-UTF16-H', $f_gothic_regular[0], |
| 446 |
'uphgothr-v', 'UniJIS-UTF16-V', $f_gothic_regular[$vi]); |
| 447 |
addgroup(\$otfuplines, ($do_otf ? \@f_mincho_bold : \@f_mincho_regular), |
| 448 |
0, $vi, |
| 449 |
'uphminb-h', 'UniJIS-UTF16-H', |
| 450 |
'uphminb-v', 'UniJIS-UTF16-V'); |
| 451 |
addgroup(\$otfuplines, ($do_otf ? \@f_gothic_bold : \@f_gothic_regular), |
| 452 |
0, $vi, |
| 453 |
'uphgothb-h', 'UniJIS-UTF16-H', |
| 454 |
'uphgothb-v', 'UniJIS-UTF16-V'); |
| 455 |
addgroup(\$otfuplines, ($do_otf ? \@f_gothic_heavy : \@f_gothic_regular), |
| 456 |
0, $vi, |
| 457 |
'uphgotheb-h', 'UniJIS-UTF16-H', |
| 458 |
'uphgotheb-v', 'UniJIS-UTF16-V'); |
| 459 |
addgroup(\$otfuplines, ($do_otf ? \@f_gothic_maru : \@f_gothic_regular), |
| 460 |
0, $vi, |
| 461 |
'uphmgothr-h', 'UniJIS-UTF16-H', |
| 462 |
'uphmgothr-v', 'UniJIS-UTF16-V'); |
| 463 |
addgroup(\$otfuplines, ($do_otf ? \@f_mincho_light : \@f_mincho_regular), |
| 464 |
0, $vi, |
| 465 |
'uphminl-h', 'UniJIS-UTF16-H', |
| 466 |
'uphminl-v', 'UniJIS-UTF16-V'); |
| 467 |
|
| 468 |
# check that none of the output files are already existing: |
| 469 |
if (-r "ptex-$group_name.map" || |
| 470 |
-r "ptex-${group_name}-04.map" || |
| 471 |
-r "uptex-$group_name.map" || |
| 472 |
-r "uptex-${group_name}-04.map" || |
| 473 |
-r "otf-$group_name.map" || |
| 474 |
-r "otf-up-$group_name.map" || |
| 475 |
-r "$group_name.map" || |
| 476 |
-r "${group_name}-04.map") { |
| 477 |
print STDERR "Some of the output files already exist in the cwd, aborting!\n"; |
| 478 |
exit 1; |
| 479 |
} |
| 480 |
|
| 481 |
# generate the output files |
| 482 |
open (OUT, ">ptex-$group_name.map") |
| 483 |
or die("Cannot open ptex-$group_name.map for writing: $!"); |
| 484 |
print OUT "% generated by $prg\n$ptexlines\n"; |
| 485 |
close(OUT); |
| 486 |
|
| 487 |
open (OUT, ">ptex-${group_name}-04.map") |
| 488 |
or die("Cannot open ptex-${group_name}-04.map for writing: $!"); |
| 489 |
print OUT "% generated by $prg\n$ptex04lines\n"; |
| 490 |
close(OUT); |
| 491 |
|
| 492 |
open (OUT, ">uptex-$group_name.map") |
| 493 |
or die("Cannot open uptex-$group_name.map for writing: $!"); |
| 494 |
print OUT "% generated by $prg\n$uptexlines\n"; |
| 495 |
close(OUT); |
| 496 |
|
| 497 |
open (OUT, ">uptex-${group_name}-04.map") |
| 498 |
or die("Cannot open uptex-${group_name}-04.map for writing: $!"); |
| 499 |
print OUT "% generated by $prg\n$uptex04lines\n"; |
| 500 |
close(OUT); |
| 501 |
|
| 502 |
open (OUT, ">otf-$group_name.map") |
| 503 |
or die("Cannot open otf-$group_name.map for writing: $!"); |
| 504 |
print OUT "% generated by $prg\n$otflines\n"; |
| 505 |
close(OUT); |
| 506 |
|
| 507 |
open (OUT, ">otf-up-$group_name.map") |
| 508 |
or die("Cannot open otf-up-$group_name.map for writing: $!"); |
| 509 |
print OUT "% generated by $prg\n$otfuplines\n"; |
| 510 |
close(OUT); |
| 511 |
|
| 512 |
open (OUT, ">$group_name.map") |
| 513 |
or die("Cannot open $group_name.map for writing: $!"); |
| 514 |
print OUT "% generated by $prg\n%\n% maps for family $group_name\n\n"; |
| 515 |
print OUT "% ptex\n$ptexlines\n"; |
| 516 |
print OUT "% uptex\n$uptexlines\n"; |
| 517 |
print OUT "% otf\n$otflines\n"; |
| 518 |
print OUT "% otf-uptex\n$otfuplines\n"; |
| 519 |
close(OUT); |
| 520 |
|
| 521 |
open (OUT, ">${group_name}-04.map") |
| 522 |
or die("Cannot open ${group_name}-04.map for writing: $!"); |
| 523 |
print OUT "% generated by $prg\n%\n% maps for family $group_name ISO2004\n\n"; |
| 524 |
print OUT "% ptex\n$ptex04lines\n"; |
| 525 |
print OUT "% uptex\n$uptex04lines\n"; |
| 526 |
print OUT "% otf\n$otflines\n"; |
| 527 |
print OUT "% otf-uptex\n$otfuplines\n"; |
| 528 |
close(OUT); |
| 529 |
|
| 530 |
my $cwd = cwd(); |
| 531 |
|
| 532 |
$mw->Dialog(-title => "Finished", |
| 533 |
-text => "Fontmaps have been created in the $cwd.\nPlease move them to a place where dvipdfmx can find them.", |
| 534 |
-buttons => [ "Finish" ])->Show(); |
| 535 |
|
| 536 |
$mw->destroy; |
| 537 |
exit 0; |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
sub win32 { return ($^O =~ /^MSWin/i ? 1 : 0); } |
| 542 |
|
| 543 |
__END__ |
| 544 |
|
| 545 |
=head1 NAME |
| 546 |
|
| 547 |
kanji-fontmap-creator - GUI to create map file collections for Kanji fonts |
| 548 |
|
| 549 |
=head1 SYNOPSIS |
| 550 |
|
| 551 |
kanji-fontmap-creator [I<option>] |
| 552 |
|
| 553 |
=head1 DESCRIPTION |
| 554 |
|
| 555 |
Create fontmap families for updmap's C<jaEmbed> setting. For details |
| 556 |
see the man page of B<updmap>(1) and the web page |
| 557 |
L<http://tug.org/texlive/updmap-kanji.html> |
| 558 |
|
| 559 |
=head1 OPTIONS |
| 560 |
|
| 561 |
=over 4 |
| 562 |
|
| 563 |
=item B<-version> |
| 564 |
|
| 565 |
Output version information and exit. |
| 566 |
|
| 567 |
=item B<-help>, B<-?>, B<-h> |
| 568 |
|
| 569 |
Display this help and exit. |
| 570 |
|
| 571 |
=item B<-lang> I<llcode> |
| 572 |
|
| 573 |
By default, the GUI tries to deduce your language from the environment |
| 574 |
(on Windows via the registry, on Unix via C<LC_MESSAGES>). If that fails |
| 575 |
you can select a different language by giving this option with a |
| 576 |
language code (based on ISO 639-1). Currently supported is only |
| 577 |
English. |
| 578 |
|
| 579 |
=back |
| 580 |
|
| 581 |
=head1 AUTHORS AND COPYRIGHT |
| 582 |
|
| 583 |
This script and documentation was written by Norbert Preining |
| 584 |
and both are licensed under the GNU General Public License Version 2 |
| 585 |
or later. |
| 586 |
|
| 587 |
=cut |
| 588 |
|
| 589 |
|
| 590 |
# vim:set tabstop=2 expandtab: # |