2024-09-17 16:42:46 +00:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# -*- mode: perl; -*-
|
|
|
|
|
|
|
|
#
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $useNonTexFonts = undef;
|
|
|
|
my $outputFormat = undef;
|
2024-09-22 09:40:28 +00:00
|
|
|
my $texFormat = undef;
|
2024-09-17 16:42:46 +00:00
|
|
|
my $language = undef;
|
|
|
|
if (-e "$ARGV[0]") {
|
|
|
|
if (open(FI, "$ARGV[0]")) {
|
|
|
|
while (my $l = <FI>) {
|
|
|
|
chomp($l);
|
|
|
|
if ($l =~ /^\\use_non_tex_fonts\s+([a-z]+)/) {
|
|
|
|
$useNonTexFonts = ($1 eq "true");
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^\\default_output_format\s+([a-z0-9]+)/) {
|
|
|
|
$outputFormat = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /\\language\s+([\-a-z_]+)/) {
|
|
|
|
$language = $1;
|
|
|
|
}
|
|
|
|
last if (defined($useNonTexFonts) && defined($outputFormat) && defined($language));
|
|
|
|
}
|
|
|
|
close(FI);
|
2024-09-22 09:40:28 +00:00
|
|
|
if (defined($ARGV[1])) {
|
|
|
|
print "outputformat = \"$outputFormat\"\n";
|
|
|
|
print "useNonTexFonts = \"$useNonTexFonts\"\n";
|
|
|
|
print "language = \"$language\"\n";
|
|
|
|
}
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
}
|
2024-09-22 09:40:28 +00:00
|
|
|
if ($language eq "japanese") {
|
2024-09-17 16:42:46 +00:00
|
|
|
if ($useNonTexFonts) {
|
2024-09-22 09:40:28 +00:00
|
|
|
if ($outputFormat =~ /^(default|pdf4)$/) {
|
|
|
|
$outputFormat = "pdf4";
|
|
|
|
$texFormat = "xetex";
|
|
|
|
}
|
|
|
|
elsif ($outputFormat =~ /^pdf[35]?$/) {
|
|
|
|
if ($outputFormat =~ /^pdf3?$/) {
|
|
|
|
$texFormat = "platex";
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
else {
|
2024-09-22 09:40:28 +00:00
|
|
|
$texFormat = "luatex";
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
}
|
2024-09-22 09:40:28 +00:00
|
|
|
else {
|
|
|
|
$outputFormat = undef;
|
|
|
|
}
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
2024-09-22 09:40:28 +00:00
|
|
|
else { # using tex font
|
|
|
|
if ($outputFormat =~ /^(default|pdf3)$/) {
|
2024-09-17 16:42:46 +00:00
|
|
|
$outputFormat = "pdf3";
|
2024-09-22 09:40:28 +00:00
|
|
|
$texFormat = "platex";
|
|
|
|
}
|
|
|
|
elsif ($outputFormat =~ /^pdf5$/) {
|
|
|
|
$texFormat = "luatex";
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
else {
|
2024-09-22 09:40:28 +00:00
|
|
|
$outputFormat = undef;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { # not a japanese language
|
|
|
|
if ($useNonTexFonts) {
|
|
|
|
if ($outputFormat =~ /^(default|pdf4)$/) {
|
|
|
|
$texFormat = "xetex";
|
|
|
|
}
|
|
|
|
elsif ($outputFormat eq "pdf5") {
|
|
|
|
$texFormat = "luatex";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$outputFormat = undef;
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
}
|
2024-09-22 09:40:28 +00:00
|
|
|
else { # using tex fonts
|
|
|
|
if ($outputFormat =~ /^(default|pdf2)$/) {
|
|
|
|
$outputFormat = "pdf2";
|
|
|
|
$texFormat = "pdflatex";
|
|
|
|
}
|
|
|
|
elsif ($outputFormat eq "pdf5") {
|
|
|
|
$texFormat = "luatex";
|
|
|
|
}
|
|
|
|
elsif ($outputFormat eq "pdf3") {
|
|
|
|
$texFormat = "latex";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$outputFormat = undef;
|
|
|
|
}
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined($outputFormat)) {
|
2024-09-22 09:40:28 +00:00
|
|
|
print "$texFormat/$outputFormat";
|
2024-09-17 16:42:46 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
print "undefined_output_format";
|
|
|
|
}
|
|
|
|
|
|
|
|
exit(0);
|