summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2006-11-29 09:55:00 +0100
committerHans Hagen <pragma@wxs.nl>2006-11-29 09:55:00 +0100
commitb32f2af73a1d64743699617f5d4453615dc8755d (patch)
treeacc22f79ad659ac59d2064824acf781ba796392e /scripts
parenta59c89b31ff0895ffa7f5b5f8784cc38449ca1a5 (diff)
downloadcontext-b32f2af73a1d64743699617f5d4453615dc8755d.tar.gz
stable 2006.11.29 09:55
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/perl/texfont.pl22
-rw-r--r--scripts/context/ruby/texexec.rb6
-rw-r--r--scripts/context/ruby/textools.rb82
3 files changed, 100 insertions, 10 deletions
diff --git a/scripts/context/perl/texfont.pl b/scripts/context/perl/texfont.pl
index ec875e5b4..e6ebf7029 100644
--- a/scripts/context/perl/texfont.pl
+++ b/scripts/context/perl/texfont.pl
@@ -137,6 +137,7 @@ my $slant = "" ;
my $spaced = "" ;
my $caps = "" ;
my $noligs = 0 ;
+my $nofligs = 0 ;
my $test = 0 ;
my $virtual = 0 ;
my $novirtual = 0 ;
@@ -175,6 +176,7 @@ my @cleanup = () ; # atl: build list of generated files to delete
( "help" => \$help,
"makepath" => \$makepath,
"noligs" => \$noligs,
+ "nofligs" => \$nofligs,
"show" => \$show,
"install" => \$install,
"encoding=s" => \$encoding,
@@ -357,7 +359,7 @@ if ($help)
report "--slant=s : slant glyphs in font by factor (0.0 - 1.5)" ;
report "--extend=s : extend glyphs in font by factor (0.0 - 1.5)" ;
report "--caps=s : capitalize lowercase chars by factor (0.5 - 1.0)" ;
- report "--noligs : remove ligatures" ;
+ report "--noligs --nofligs : remove ligatures" ;
print "\n" ;
report "--install : copy files from source to font tree" ;
report "--listing : list files on auto sourcepath" ;
@@ -436,7 +438,7 @@ my $outlinepath = $sourcepath ; my $path = "" ;
my $shape = "" ;
-if ($noligs)
+if ($noligs||$nofligs)
{ report ("ligatures : removed") ;
$fontsuffix .= "-unligatured" ;
$namesuffix .= "-NoLigs" }
@@ -1170,9 +1172,9 @@ foreach my $file (@files)
if ($afmpl)
{ report " generating pl : $cleanname$fontsuffix (from $cleanname)" ;
$encstr = " -p $encfil" ;
-if ($uselmencodings) {
- $encstr =~ s/(ec)\.enc$/lm\-$1\.enc/ ;
-}
+ if ($uselmencodings) {
+ $encstr =~ s/(ec)\.enc$/lm\-$1\.enc/ ;
+ }
my $command = "afm2pl -f afm2tfm $shape $passon $encstr $file $cleanname$fontsuffix.vpl" ;
print "$command\n" if $trace ;
my $ok = `$command` ;
@@ -1191,19 +1193,21 @@ if ($uselmencodings) {
if ($font =~ /.*?([\d\.]+)\s*SlantFont/io) { $slant = $1 }
if ($extend ne "") { $option .= " $extend ExtendFont " }
if ($slant ne "") { $option .= " $slant SlantFont " }
- if ($noligs) { removeligatures("$raw$cleanname$fontsuffix") }
if ($afmpl)
- { report "generating new tfm : $use$cleanname$fontsuffix" ;
+ { if ($noligs||$nofligs) { removeligatures("$cleanname$fontsuffix") }
+ report "generating new tfm : $use$cleanname$fontsuffix" ;
my $command = "pltotf $cleanname$fontsuffix.vpl $use$cleanname$fontsuffix.tfm" ;
print "$command\n" if $trace ;
my $ok = `$command` }
elsif ($virtual)
- { report "generating new vf : $use$cleanname$fontsuffix (from $use$cleanname)" ;
+ { if ($noligs||$nofligs) { removeligatures("$use$cleanname$fontsuffix") }
+ report "generating new vf : $use$cleanname$fontsuffix (from $use$cleanname)" ;
my $command = "vptovf $use$cleanname$fontsuffix.vpl $use$cleanname$fontsuffix.vf $use$cleanname$fontsuffix.tfm" ;
print "$command\n" if $trace ;
my $ok = `$command` }
else
- { report "generating new tfm : $use$cleanname$fontsuffix (from $raw$cleanname)" ;
+ { if ($noligs||$nofligs) { removeligatures("$raw$cleanname$fontsuffix") }
+ report "generating new tfm : $use$cleanname$fontsuffix (from $raw$cleanname)" ;
my $command = "pltotf $raw$cleanname$fontsuffix.vpl $use$cleanname$fontsuffix.tfm" ;
print "$command\n" if $trace ;
my $ok = `$command` } } }
diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb
index 55636780d..ea4c48d93 100644
--- a/scripts/context/ruby/texexec.rb
+++ b/scripts/context/ruby/texexec.rb
@@ -428,7 +428,11 @@ job.setvariable('result',result)
if files.length > 0 then
if f = File.open(job.tempfilename('tex'),'w') then
scale = @commandline.checkedoption('scale')
- scale = (scale * 1000).to_i if scale.to_i < 10
+ begin
+ scale = (scale.to_i * 1000).to_i if scale.to_i < 10
+ rescue
+ scale = 1000
+ end
paperoffset = @commandline.checkedoption('paperoffset', '0cm')
f << "\\starttext\n"
files.each do |filename|
diff --git a/scripts/context/ruby/textools.rb b/scripts/context/ruby/textools.rb
index 345a27572..b6300215e 100644
--- a/scripts/context/ruby/textools.rb
+++ b/scripts/context/ruby/textools.rb
@@ -658,6 +658,87 @@ class Commands
end
+ @@knownchars = Hash.new
+
+ @@knownchars['ae'] = 'aeligature' ; @@knownchars['oe'] = 'oeligature'
+ @@knownchars['AE'] = 'AEligature' ; @@knownchars['OE'] = 'OEligature'
+
+ @@knownchars['acute' ] = 'textacute'
+ @@knownchars['breve' ] = 'textbreve'
+ @@knownchars['caron' ] = 'textcaron'
+ @@knownchars['cedilla' ] = 'textcedilla'
+ @@knownchars['circumflex' ] = 'textcircumflex'
+ @@knownchars['diaeresis' ] = 'textdiaeresis'
+ @@knownchars['dotaccent' ] = 'textdotaccent'
+ @@knownchars['grave' ] = 'textgrave'
+ @@knownchars['hungarumlaut'] = 'texthungarumlaut'
+ @@knownchars['macron' ] = 'textmacron'
+ @@knownchars['ogonek' ] = 'textogonek'
+ @@knownchars['ring' ] = 'textring'
+ @@knownchars['tilde' ] = 'texttilde'
+
+ @@knownchars['cent' ] = 'textcent'
+ @@knownchars['currency'] = 'textcurrency'
+ @@knownchars['euro' ] = 'texteuro'
+ @@knownchars['florin' ] = 'textflorin'
+ @@knownchars['sterling'] = 'textsterling'
+ @@knownchars['yen' ] = 'textyen'
+
+ @@knownchars['brokenbar'] = 'textbrokenbar'
+ @@knownchars['bullet' ] = 'textbullet'
+ @@knownchars['dag' ] = 'textdag'
+ @@knownchars['ddag' ] = 'textddag'
+ @@knownchars['degree' ] = 'textdegree'
+ @@knownchars['div' ] = 'textdiv'
+ @@knownchars['ellipsis' ] = 'textellipsis'
+ @@knownchars['fraction' ] = 'textfraction'
+ @@knownchars['lognot' ] = 'textlognot'
+ @@knownchars['minus' ] = 'textminus'
+ @@knownchars['mu' ] = 'textmu'
+ @@knownchars['multiply' ] = 'textmultiply'
+ @@knownchars['pm' ] = 'textpm'
+
+ def encmake
+ afmfile = @commandline.argument('first')
+ encoding = @commandline.argument('second') || 'dummy'
+ if afmfile && FileTest.file?(afmfile) then
+ chars = Array.new
+ IO.readlines(afmfile).each do |line|
+ if line =~ /C\s+(\d+).*?N\s+([a-zA-Z\-\.]+?)\s*;/ then
+ chars[$1.to_i] = $2
+ end
+ end
+ if f = File.open(encoding+'.enc','w') then
+ f << "% Encoding file, generated by textools.rb from #{afmfile}\n"
+ f << "\n"
+ f << "/#{encoding.gsub(/[^a-zA-Z]/,'')}encoding [\n"
+ 256.times do |i|
+ f << " /#{chars[i] || '.notdef'}\n"
+ end
+ f << "] def\n"
+ f.close
+ end
+ if f = File.open('enco-'+encoding+'.tex','w') then
+ f << "% ConTeXt file, generated by textools.rb from #{afmfile}\n"
+ f << "\n"
+ f << "\\startencoding[#{encoding}]\n\n"
+ 256.times do |i|
+ if str = chars[i] then
+ tmp = str.gsub(/dieresis/,'diaeresis')
+ if chr = @@knownchars[tmp] then
+ f << " \\definecharacter #{chr} #{i}\n"
+ elsif tmp.length > 5 then
+ f << " \\definecharacter #{tmp} #{i}\n"
+ end
+ end
+ end
+ f << "\n\\stopencoding\n"
+ f << "\n\\endinput\n"
+ f.close
+ end
+ end
+ end
+
private
def flushencoding (file, from, to, names)
@@ -930,6 +1011,7 @@ commandline.registeraction('updatetree' , 'fromroot toroot [--force --noch
commandline.registeraction('downcasefilenames', '[--recurse] [--force]') # not yet documented
commandline.registeraction('stripformfeeds' , '[--recurse] [--force]') # not yet documented
commandline.registeraction('showfont' , 'filename')
+commandline.registeraction('encmake' , 'afmfile encodingname')
commandline.registeraction('tpmmake' , 'tpm file (run in texmf root)')