<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/env perl
#
# kanji-fontmap-creator
# (c) 2012-2014 Norbert Preining
# Version: 20210625.0
# Licenced under the GPLv2 or any higher version
#
# gui to create map files for (kanji-config-)updmap
#
# ptex/uptex:
#  2 fonts (rml/gbm)
#  2 variants
#  (ev vertical/horizontal)
#
# otf/otf-up:
#  
#  2 variants
#  fonts:
#    gothic: regular, bold, heavy, maru
#    mincho: regular, bold, light
#
# possible improvements:
# - allow editing current files by reading and interpreting them
#   needs better structure of the data
# - specify output directory, automatically write to $TEXMFLOCAL ?
# - more checks, warnings?
#

$^W = 1;
use strict;

use Tk;
use Tk::NoteBook;
use Tk::Dialog;
use Cwd;
use Getopt::Long qw(:config no_autoabbrev);
use Pod::Usage;

my $opt_lang = "en";
my $opt_help = 0;
my $opt_version = 0;

my $prg = "kanji-fontmap-creator";
my $version = "20210625.0";

#
# global vars configuring operation
my $group_name = "";
my $do_vertical = 0;
my $do_iso2004  = 0;
my $do_otf      = 0;
my @f_mincho_regular; my @f_gothic_regular;
my @f_mincho_bold; my @f_gothic_bold;
my @f_gothic_heavy;
my @f_gothic_maru;
my @f_mincho_light;
my $b_save;

my $iso_i  = 1;
my $vert_i = 2;
my $isovert_i = 3;
my @order;

my $mw;

$order[0] = 'Default';
$order[$iso_i] = 'ISO2004';
$order[$vert_i] = 'Vertical';
$order[$isovert_i] = 'ISO2004/Vertical';


GetOptions(
  "lang=s"   =&gt; \$opt_lang,
  "version"  =&gt; \$opt_version,
  "help|?|h" =&gt; \$opt_help) or pod2usage(1);

if (win32()) {
  pod2usage(-exitstatus =&gt; 0,
            -verbose =&gt; 2,
            -noperldoc =&gt; 1,
            -output  =&gt; \*STDOUT) if $opt_help;
} else {
  pod2usage(-exitstatus =&gt; 0, -verbose =&gt; 2, -file =&gt; $0) if $opt_help;
}

if ($opt_version) {
  print "$prg $version\n";
  exit 0;
}

if ($opt_lang ne "en") {
  print STDERR "$prg: languages other than en currently not implemented.\n";
}

&amp;main();

sub main {
  #
  #
  $mw = MainWindow-&gt;new;
  $mw-&gt;title("Kanji Fontmap Creator");
  $mw-&gt;optionAdd("*Button.Relief", "ridge", 20);
  my $tf = $mw-&gt;Frame;
  my $nb = $mw-&gt;NoteBook;
  my $bf = $mw-&gt;Frame;
  #
  # top frame
  #
  my $name_label = $tf-&gt;Label(-text =&gt; "Group name:");
  my $name_entry = $tf-&gt;Entry(-width =&gt; 30, -textvariable =&gt; \$group_name,
    -validate =&gt; "all", -validatecommand =&gt; \&amp;validate_group_name);
  my $opt_label  = $tf-&gt;Label(-text =&gt; "Options:");
  my $opt_vert   = $tf-&gt;Checkbutton(-text =&gt; "separate vertical fonts",
    -variable =&gt; \$do_vertical);
  my $opt_iso    = $tf-&gt;Checkbutton(-text =&gt; "separate ISO 2004 support",
    -variable =&gt; \$do_iso2004 );
  my $opt_otf    = $tf-&gt;Checkbutton(-text =&gt; "OTF support",
    -variable =&gt; \$do_otf);
  #
  # pack the stuff
  $name_label-&gt;grid(-row =&gt; 0, -column =&gt; 0, -sticky =&gt; "e");
  $name_entry-&gt;grid(-row =&gt; 0, -column =&gt; 1, -sticky =&gt; "w");
  $opt_label-&gt;grid(-row =&gt; 1, -column =&gt; 0, -sticky =&gt; "e");
  $opt_otf-&gt;grid(-row =&gt; 1, -column =&gt; 1, -sticky =&gt; "w");
  $opt_iso-&gt;grid(-column =&gt; 1, -sticky =&gt; "w");
  $opt_vert-&gt;grid(-column =&gt; 1, -sticky =&gt; "w");
  #
  # notebook part
  my @p;
  for my $i (0..$#order) {
    $p[$i] = $nb-&gt;add($order[$i], -label =&gt; $order[$i],
      -state =&gt; ($i &gt; 0 ? "disabled" : "normal"));
  }
  #
  # pack outer window
  $tf-&gt;pack(-expand =&gt; 1, -fill =&gt; 'x', -padx =&gt; '4m', -pady =&gt; '4m');
  $nb-&gt;pack(-expand =&gt; 1, -fill =&gt; 'both', -padx =&gt; '4m');
  $bf-&gt;pack(-expand =&gt; 1, -fill =&gt; 'x', -padx =&gt; '4m', -pady =&gt; '4m');
  #
  # 
  my @l_mincho; my @l_gothic;
  my @l_regular;
  my @l_bold;
  my @l_heavy;
  my @l_light;
  my @l_maru;
  my @e_mincho_regular; my @e_gothic_regular;
  my @e_mincho_bold; my @e_gothic_bold;
  my @e_gothic_heavy;
  my @e_gothic_maru;
  my @e_mincho_light;
  my $ew = 20;
  for my $i (0..$#order) {
    $l_mincho[$i] = $p[$i]-&gt;Label(-text =&gt; "Mincho");
    $l_gothic[$i] = $p[$i]-&gt;Label(-text =&gt; "Gothic");
    #
    $l_regular[$i] = $p[$i]-&gt;Label(-text =&gt; "Regular");
    $e_mincho_regular[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_mincho_regular[$i]);
    $e_gothic_regular[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_gothic_regular[$i]);
    #
    $l_bold[$i] = $p[$i]-&gt;Label(-text =&gt; "Bold", -state =&gt; "disabled");
    $e_mincho_bold[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_mincho_bold[$i],
      -state =&gt; "disabled", -relief =&gt; "flat");
    $e_gothic_bold[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_gothic_bold[$i],
      -state =&gt; "disabled", -relief =&gt; "flat");
    #
    $l_heavy[$i] = $p[$i]-&gt;Label(-text =&gt; "Heavy", -state =&gt; "disabled");
    $l_light[$i] = $p[$i]-&gt;Label(-text =&gt; "Light", -state =&gt; "disabled");
    $l_maru[$i] =  $p[$i]-&gt;Label(-text =&gt; "Maru",  -state =&gt; "disabled");
    $e_gothic_heavy[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_gothic_heavy[$i],
      -state =&gt; "disabled", -relief =&gt; "flat");
    $e_gothic_maru[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_gothic_maru[$i],
      -state =&gt; "disabled", -relief =&gt; "flat");
    $e_mincho_light[$i] = $p[$i]-&gt;Entry(-width =&gt; $ew,
      -textvariable =&gt; \$f_mincho_light[$i],
      -state =&gt; "disabled", -relief =&gt; "flat");
    #
    # grid the whole stuff
    $l_mincho[$i]-&gt;grid(-row =&gt; 0, -column =&gt; 1);
    $l_gothic[$i]-&gt;grid(-row =&gt; 0, -column =&gt; 2);
    #
    $l_regular[$i]-&gt;grid(-row =&gt; 1, -column =&gt; 0,  -sticky =&gt; "e");
    $e_mincho_regular[$i]-&gt;grid(-row =&gt; 1, -column =&gt; 1);
    $e_gothic_regular[$i]-&gt;grid(-row =&gt; 1, -column =&gt; 2);
    #
    $l_bold[$i]-&gt;grid(-row =&gt; 3, -column =&gt; 0,  -sticky =&gt; "e");
    $e_mincho_bold[$i]-&gt;grid(-row =&gt; 3, -column =&gt; 1);
    $e_gothic_bold[$i]-&gt;grid(-row =&gt; 3, -column =&gt; 2);
    #
    $l_heavy[$i]-&gt;grid(-row =&gt; 4, -column =&gt; 0,  -sticky =&gt; "e");
    $e_gothic_heavy[$i]-&gt;grid(-row =&gt; 4, -column =&gt; 1);
    $l_maru[$i]-&gt;grid(-row =&gt; 5, -column =&gt; 0,  -sticky =&gt; "e");
    $e_gothic_maru[$i]-&gt;grid(-row =&gt; 5, -column =&gt; 2);
    $l_light[$i]-&gt;grid(-row =&gt; 6, -column =&gt; 0,  -sticky =&gt; "e");
    $e_mincho_light[$i]-&gt;grid(-row =&gt; 6, -column =&gt; 2);
  }
  #
  # Button frame
  $b_save = $bf-&gt;Button(-text =&gt; "Save");

  #
  # Actions:
  #
  # activate tabs when options are selected
  $opt_vert-&gt;configure(-command =&gt; sub { 
      if (!$do_vertical &amp;&amp; ($nb-&gt;raised() =~ m/Vertical/)) {
        $nb-&gt;raise("Default");
      }
      $nb-&gt;pageconfigure("Vertical", 
        -state =&gt; ($do_vertical ? "normal" : "disabled"));
      $nb-&gt;pageconfigure("ISO2004/Vertical",
        -state =&gt; (($do_vertical &amp; $do_iso2004) ? "normal" : "disabled"))
    });
  $opt_iso-&gt;configure(-command =&gt; sub { 
      if (!$do_iso2004 &amp;&amp; ($nb-&gt;raised() =~ m/ISO2004/)) {
        $nb-&gt;raise("Default");
      }
      $nb-&gt;pageconfigure("ISO2004",
        -state =&gt; ($do_iso2004 ? "normal" : "disabled"));
      $nb-&gt;pageconfigure("ISO2004/Vertical",
        -state =&gt; (($do_vertical &amp; $do_iso2004) ? "normal" : "disabled")) 
    });

  # activate lower part for when otf is selected
  $opt_otf-&gt;configure(-command =&gt; sub {
    for my $i (0..$#order) {
      $l_light[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"));
      $e_mincho_light[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"),
        -relief =&gt; ($do_otf ? "sunken" : "flat"));
      #
      $l_bold[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"));
      $e_mincho_bold[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"),
        -relief =&gt; ($do_otf ? "sunken" : "flat"));
      $e_gothic_bold[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"),
        -relief =&gt; ($do_otf ? "sunken" : "flat"));
      #
      $l_heavy[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"));
      $l_maru[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"));
      $e_gothic_maru[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"),
        -relief =&gt; ($do_otf ? "sunken" : "flat"));
      $e_gothic_heavy[$i]-&gt;configure(
        -state =&gt; ($do_otf ? "normal" : "disabled"),
        -relief =&gt; ($do_otf ? "sunken" : "flat"));
    }
  });
  #
  #
  $b_save-&gt;configure(-command =&gt; \&amp;export_font_maps, -state =&gt; "disabled");
  $b_save-&gt;pack;

  Tk::MainLoop();
}

sub validate_group_name {
  my ($new_val, undef, $old_val) = @_;
  $b_save-&gt;configure(-state =&gt; ($new_val eq "" ? "disabled" : "normal"));
  return 1;
}

sub addgroup {
  my ($str, $fref, $i_a, $i_b, @entries) = @_;
  my $do = 1;
  while (@entries) {
    my $tfm = shift @entries;
    my $enc = shift @entries;
    addlines($str, $tfm, $enc, ($do ? $fref-&gt;[$i_a] : $fref-&gt;[$i_b]));
    $do = !$do;
  } 
}

sub addlines {
  my ($strref, @entries) = @_;
  while (@entries) {
    my $tfm = shift @entries;
    my $enc = shift @entries;
    my $fn  = shift @entries;
    if (defined($fn)) {
      $$strref .= "$tfm $enc $fn\n";
    } else {
      print STDERR "target file for $tfm $enc not defined!\n";
    }
  }
}

sub export_font_maps {
  if ($group_name eq "") {
    print STDERR "That should not happen!\n";
    exit 1;
  }

  # indirections
  my $ii = ($do_iso2004  ?  $iso_i  : 0);
  my $vi = ($do_vertical ?  $vert_i : 0);
  my $ivi = (($do_vertical &amp;&amp; $do_vertical) ?  $isovert_i : 0);
  #
  
  my ($ptexlines, $ptex04lines, $uptexlines, $uptex04lines);
  my ($otflines, $otfuplines);
  addlines(\$ptexlines, 
    'rml', 'H', $f_mincho_regular[0],
    'rmlv','V', $f_mincho_regular[$vi],
    'gbm', 'H', $f_gothic_regular[0],
    'gbmv','V', $f_gothic_regular[$vi]);
  addlines(\$ptex04lines, 
    'rml', 'H', $f_mincho_regular[$ii],
    'rmlv','V', $f_mincho_regular[$ivi],
    'gbm', 'H', $f_gothic_regular[$ii],
    'gbmv','V', $f_gothic_regular[$ivi]);
  addlines(\$uptexlines,
    'urml',     'UniJIS-UTF16-H', $f_mincho_regular[0],
    'urmlv',    'UniJIS-UTF16-V', $f_mincho_regular[$vi],
    'ugbm',     'UniJIS-UTF16-H', $f_gothic_regular[0],
    'ugbmv',    'UniJIS-UTF16-V', $f_gothic_regular[$vi],
    'uprml-h',  'UniJIS-UTF16-H', $f_mincho_regular[0],
    'uprml-v',  'UniJIS-UTF16-V', $f_mincho_regular[$vi],
    'upgbm-h',  'UniJIS-UTF16-H', $f_gothic_regular[0],
    'upgbm-v',  'UniJIS-UTF16-V', $f_gothic_regular[$vi],
    'uprml-hq', 'UniJIS-UCS2-H',  $f_mincho_regular[0],
    'upgbm-hq', 'UniJIS-UCS2-H',  $f_gothic_regular[0]);
  addlines(\$uptex04lines,
    'urml',     'UniJIS-UTF16-H', $f_mincho_regular[$ii],
    'urmlv',    'UniJIS-UTF16-V', $f_mincho_regular[$ivi],
    'ugbm',     'UniJIS-UTF16-H', $f_gothic_regular[$ii],
    'ugbmv',    'UniJIS-UTF16-V', $f_gothic_regular[$ivi],
    'uprml-h',  'UniJIS-UTF16-H', $f_mincho_regular[$ii],
    'uprml-v',  'UniJIS-UTF16-V', $f_mincho_regular[$ivi],
    'upgbm-h',  'UniJIS-UTF16-H', $f_gothic_regular[$ii],
    'upgbm-v',  'UniJIS-UTF16-V', $f_gothic_regular[$ivi],
    'uprml-hq', 'UniJIS-UCS2-H',  $f_mincho_regular[$ii],
    'upgbm-hq', 'UniJIS-UCS2-H',  $f_gothic_regular[$ii]);
 
  
  addlines(\$otflines,
    '%', 'mincho regular', '',
    'otf-ujmr-h', 'UniJIS-UTF16-H', $f_mincho_regular[0],
    'otf-ujmr-v', 'UniJIS-UTF16-V', $f_mincho_regular[$vi],
    'otf-cjmr-h', 'Identity-H',     $f_mincho_regular[0],
    'otf-cjmr-v', 'Identity-V',     $f_mincho_regular[$vi],
    'hminr-h',    'H',              $f_mincho_regular[0],
    'hminr-v',    'V',              $f_mincho_regular[$vi],
    '%', 'gothic regular', '',
    'otf-ujgr-h', 'UniJIS-UTF16-H', $f_gothic_regular[0],
    'otf-ujgr-v', 'UniJIS-UTF16-V', $f_gothic_regular[$vi],
    'otf-cjgr-h', 'Identity-H',     $f_gothic_regular[0],
    'otf-cjgr-v', 'Identity-V',     $f_gothic_regular[$vi],
    'hgothr-h',   'H',              $f_gothic_regular[0],
    'hgothr-v',   'V',              $f_gothic_regular[$vi],
    '%', 'mincho bold', '');
  addgroup(\$otflines, ($do_otf ? \@f_mincho_bold : \@f_mincho_regular),
    0, $vi,
    'otf-ujmb-h', 'UniJIS-UTF16-H',
    'otf-ujmb-v', 'UniJIS-UTF16-V',
    'otf-cjmb-h', 'Identity-H',
    'otf-cjmb-v', 'Identity-V',
    'hminb-h',    'H',
    'hminb-v',    'V');
  addlines(\$otflines, '%', 'gothic bold', '');
  addgroup(\$otflines, ($do_otf ? \@f_gothic_bold : \@f_gothic_regular),
    0, $vi,
    'otf-ujgb-h', 'UniJIS-UTF16-H',
    'otf-ujgb-v', 'UniJIS-UTF16-V',
    'otf-cjgb-h', 'Identity-H',
    'otf-cjgb-v', 'Identity-V',
    'hgothb-h',   'H',
    'hgothb-v',   'V');
  addlines(\$otflines, '%', 'gothic heavy', '');
  addgroup(\$otflines, ($do_otf ? \@f_gothic_heavy : \@f_gothic_regular),
    0, $vi,
    'hgotheb-h', 'H',
    'hgotheb-v', 'V');
  addlines(\$otflines, '%', 'gothic maru', '');
  addgroup(\$otflines, ($do_otf ? \@f_gothic_maru : \@f_gothic_regular),
    0, $vi,
    'otf-ujmgr-h', 'UniJIS-UTF16-H',
    'otf-ujmgr-v', 'UniJIS-UTF16-V',
    'otf-cjmgr-h', 'Identity-H',
    'otf-cjmgr-v', 'Identity-V',
    'hmgothr-h',   'H',
    'hmgothr-v',   'V');
  addlines(\$otflines, '%', 'mincho light', '');
  addgroup(\$otflines, ($do_otf ? \@f_mincho_light : \@f_mincho_regular),
    0, $vi,
    'otf-ujml-h', 'UniJIS-UTF16-H',
    'otf-ujml-v', 'UniJIS-UTF16-V',
    'otf-cjml-h', 'Identity-H',
    'otf-cjml-v', 'Identity-V',
    'hminl-h',    'H',
    'hminl-v',    'V');
  addlines(\$otflines, '%', 'JIS 2004', '',
    'otf-ujmrn-h', 'UniJIS2004-UTF16-H', $f_mincho_regular[$ii],
    'otf-ujmrn-v', 'UniJIS2004-UTF16-V', $f_mincho_regular[$ivi],
    'hminrn-h',    'H',                  $f_mincho_regular[$ii],
    'hminrn-v',    'V',                  $f_mincho_regular[$ivi],
    '%', '', '',
    'otf-ujgrn-h', 'UniJIS2004-UTF16-H', $f_gothic_regular[$ii],
    'otf-ujgrn-v', 'UniJIS2004-UTF16-V', $f_gothic_regular[$ivi],
    'hgothrn-h',   'H'                 , $f_gothic_regular[$ii],
    'hgothrn-v',   'V'                 , $f_gothic_regular[$ivi],
    '%', '', '');
  addgroup(\$otflines, ($do_otf ? \@f_mincho_bold : \@f_mincho_regular),
    $ii, $ivi,
    'otf-ujmbn-h', 'UniJIS2004-UTF16-H',
    'otf-ujmbn-v', 'UniJIS2004-UTF16-V',
    'hminbn-h',    'H',
    'hminbn-v',    'V');
  addlines(\$otflines, '%', '', '');
  addgroup(\$otflines, ($do_otf ? \@f_gothic_bold : \@f_gothic_regular),
    $ii, $ivi,
    'otf-ujgbn-h', 'UniJIS2004-UTF16-H',
    'otf-ujgbn-v', 'UniJIS2004-UTF16-V',
    'hgothbn-h',   'H',
    'hgothbn-v',   'V');
  addlines(\$otflines, '%', '', '');
  addgroup(\$otflines, ($do_otf ? \@f_gothic_heavy : \@f_gothic_regular),
    $ii, $ivi,
    'otf-ujmgrn-h', 'UniJIS2004-UTF16-H',
    'otf-ujmgrn-v', 'UniJIS2004-UTF16-V',
    'hmgothrn-h', 'H',
    'hmgothrn-v', 'V');
  addlines(\$otflines, '%', '', '');
  addgroup(\$otflines, ($do_otf ? \@f_mincho_light : \@f_mincho_regular),
    $ii, $ivi,
    'otf-ujmln-h', 'UniJIS2004-UTF16-H',
    'otf-ujmln-v', 'UniJIS2004-UTF16-V',
    'hminln-h',    'H',
    'hminln-v',    'V');

  addlines(\$otfuplines,
    'uphminr-h',   'UniJIS-UTF16-H', $f_mincho_regular[0],
    'uphminr-v',   'UniJIS-UTF16-V', $f_mincho_regular[$vi],
    'uphgothr-h',  'UniJIS-UTF16-H', $f_gothic_regular[0],
    'uphgothr-v',  'UniJIS-UTF16-V', $f_gothic_regular[$vi]);
  addgroup(\$otfuplines, ($do_otf ? \@f_mincho_bold : \@f_mincho_regular),
    0, $vi,
    'uphminb-h',   'UniJIS-UTF16-H',
    'uphminb-v',   'UniJIS-UTF16-V');
  addgroup(\$otfuplines, ($do_otf ? \@f_gothic_bold : \@f_gothic_regular),
    0, $vi,
    'uphgothb-h',  'UniJIS-UTF16-H',
    'uphgothb-v',  'UniJIS-UTF16-V');
  addgroup(\$otfuplines, ($do_otf ? \@f_gothic_heavy : \@f_gothic_regular),
    0, $vi,
    'uphgotheb-h', 'UniJIS-UTF16-H',
    'uphgotheb-v', 'UniJIS-UTF16-V');
  addgroup(\$otfuplines, ($do_otf ? \@f_gothic_maru : \@f_gothic_regular),
    0, $vi,
    'uphmgothr-h', 'UniJIS-UTF16-H',
    'uphmgothr-v', 'UniJIS-UTF16-V');
  addgroup(\$otfuplines, ($do_otf ? \@f_mincho_light : \@f_mincho_regular),
    0, $vi,
    'uphminl-h',   'UniJIS-UTF16-H',
    'uphminl-v',   'UniJIS-UTF16-V');

  # check that none of the output files are already existing:
  if (-r "ptex-$group_name.map" ||
      -r "ptex-${group_name}-04.map" ||
      -r "uptex-$group_name.map" ||
      -r "uptex-${group_name}-04.map" ||
      -r "otf-$group_name.map" ||
      -r "otf-up-$group_name.map" ||
      -r "$group_name.map" ||
      -r "${group_name}-04.map") {
    print STDERR "Some of the output files already exist in the cwd, aborting!\n";
    exit 1;
  }

  # generate the output files
  open (OUT, "&gt;ptex-$group_name.map") 
    or die("Cannot open ptex-$group_name.map for writing: $!");
  print OUT "% generated by $prg\n$ptexlines\n";
  close(OUT);

  open (OUT, "&gt;ptex-${group_name}-04.map")
    or die("Cannot open ptex-${group_name}-04.map for writing: $!");
  print OUT "% generated by $prg\n$ptex04lines\n";
  close(OUT);

  open (OUT, "&gt;uptex-$group_name.map") 
    or die("Cannot open uptex-$group_name.map for writing: $!");
  print OUT "% generated by $prg\n$uptexlines\n";
  close(OUT);

  open (OUT, "&gt;uptex-${group_name}-04.map")
    or die("Cannot open uptex-${group_name}-04.map for writing: $!");
  print OUT "% generated by $prg\n$uptex04lines\n";
  close(OUT);

  open (OUT, "&gt;otf-$group_name.map") 
    or die("Cannot open otf-$group_name.map for writing: $!");
  print OUT "% generated by $prg\n$otflines\n";
  close(OUT);

  open (OUT, "&gt;otf-up-$group_name.map") 
    or die("Cannot open otf-up-$group_name.map for writing: $!");
  print OUT "% generated by $prg\n$otfuplines\n";
  close(OUT);
 
  open (OUT, "&gt;$group_name.map")
    or die("Cannot open $group_name.map for writing: $!");
  print OUT "% generated by $prg\n%\n% maps for family $group_name\n\n";
  print OUT "% ptex\n$ptexlines\n";
  print OUT "% uptex\n$uptexlines\n";
  print OUT "% otf\n$otflines\n";
  print OUT "% otf-uptex\n$otfuplines\n";
  close(OUT);
 
  open (OUT, "&gt;${group_name}-04.map")
    or die("Cannot open ${group_name}-04.map for writing: $!");
  print OUT "% generated by $prg\n%\n% maps for family $group_name ISO2004\n\n";
  print OUT "% ptex\n$ptex04lines\n";
  print OUT "% uptex\n$uptex04lines\n";
  print OUT "% otf\n$otflines\n";
  print OUT "% otf-uptex\n$otfuplines\n";
  close(OUT);

  my $cwd = cwd();
  
  $mw-&gt;Dialog(-title =&gt; "Finished",
    -text =&gt; "Fontmaps have been created in the $cwd.\nPlease move them to a place where dvipdfmx can find them.",
    -buttons =&gt; [ "Finish" ])-&gt;Show();
 
  $mw-&gt;destroy;
  exit 0;
}


sub win32 { return ($^O =~ /^MSWin/i ? 1 : 0); }

__END__

=head1 NAME

kanji-fontmap-creator - GUI to create map file collections for Kanji fonts

=head1 SYNOPSIS

kanji-fontmap-creator [I&lt;option&gt;]

=head1 DESCRIPTION

Create fontmap families for updmap's C&lt;jaEmbed&gt; setting. For details
see the man page of B&lt;updmap&gt;(1) and the web page
L&lt;http://tug.org/texlive/updmap-kanji.html&gt;

=head1 OPTIONS

=over 4

=item B&lt;-version&gt;

Output version information and exit.

=item B&lt;-help&gt;, B&lt;-?&gt;, B&lt;-h&gt;

Display this help and exit.

=item B&lt;-lang&gt; I&lt;llcode&gt;

By default, the GUI tries to deduce your language from the environment
(on Windows via the registry, on Unix via C&lt;LC_MESSAGES&gt;). If that fails
you can select a different language by giving this option with a
language code (based on ISO 639-1).  Currently supported is only
English.

=back

=head1 AUTHORS AND COPYRIGHT

This script and documentation was written by Norbert Preining
and both are licensed under the GNU General Public License Version 2 
or later.

=cut


# vim:set tabstop=2 expandtab: #
</pre></body></html>