File: make-enc.pl

package info (click to toggle)
texlive-lang 2016.20170123-5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,093,148 kB
  • ctags: 15,901
  • sloc: perl: 46,074; xml: 29,603; makefile: 5,248; sh: 3,179; python: 2,949; ansic: 2,846; ruby: 945; lisp: 726; awk: 636; java: 159; sed: 142; cpp: 12
file content (48 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download | duplicates (34)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

$enc2uni=$ARGV[0];
$encname=$ARGV[1];
shift;shift;
$glyph2uni=join("', `",@ARGV);

while(<>) {
	if ($_ =~ /^#/) { next }
	s/(....);([^;]*);/$glyphenc{$1}=$2/e;
}

print <<"ENDHEADER";
% This file is generated from `$enc2uni' and `$glyph2uni'
%
% LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ;
% LIGKERN quoteleft quoteleft =: quotedblleft ;
% LIGKERN quoteright quoteright =: quotedblright ;
% LIGKERN comma comma =: quotedblbase ; less less =: guillemotleft ;
% LIGKERN greater greater =: guillemotright ;
% LIGKERN f f =: ff ; f i =: fi ; f l =: fl ; ff i =: ffi ; ff l =: ffl ;
%
% LIGKERN space {} * ; * {} space ; zero {} * ; * {} zero ;
% LIGKERN one {} * ; * {} one ; two {} * ; * {} two ;
% LIGKERN three {} * ; * {} three ; four {} * ; * {} four ;
% LIGKERN five {} * ; * {} five ; six {} * ; * {} six ;
% LIGKERN seven {} * ; * {} seven ; eight {} * ; * {} eight ;
% LIGKERN nine {} * ; * {} nine ;
%
/${encname}Encoding [
ENDHEADER

$n=0;
open(ENC2UNI,$enc2uni);
while(<ENC2UNI>) {
	if ($_ =~ /^#/) { next }
	s/(..);([^;]*);/$codeenc=$1;$codeuni=$2/e;
	if ($n % 16 == 0) { printf "%% 0x%02X\n",$n }
	$n++;
	if ($glyphenc{$codeuni} ne "") {
		print "/$glyphenc{$codeuni}\n";
	} else {
		print "/.notdef\n";
	}
}
close(ENC2UNI);

print "] def\n";