summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/ptexdir
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-01-27 02:23:14 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-01-27 02:23:14 +0000
commit5818288af5e420fda055a4d53fb22333a66cd7ad (patch)
tree7d3eef35c0853a1c06d4dda762ec17e63c24f81a /Build/source/texk/web2c/ptexdir
parent377d5b6a96e2b1ad97c691da9c9e3f187e51364a (diff)
ptexdir, uptexdir: introduce a new JFM spec
git-svn-id: svn://tug.org/texlive/trunk@46452 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/ptexdir')
-rw-r--r--Build/source/texk/web2c/ptexdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/ptexdir/pdvitype.ch4
-rw-r--r--Build/source/texk/web2c/ptexdir/ppltotf.ch26
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch20
-rw-r--r--Build/source/texk/web2c/ptexdir/ptftopl.ch14
5 files changed, 57 insertions, 14 deletions
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog
index d4deadb2bd6..b185d6952fc 100644
--- a/Build/source/texk/web2c/ptexdir/ChangeLog
+++ b/Build/source/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-27 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * ppltotf.ch, ptftopl.ch: Introduce a new JFM spec, to allow
+ 3-byte characters in TYPE > 0 for upTeX. The new spec is
+ effectively upper compatible with the original one.
+ * ptex-base.ch, pdvitype.ch: Adapt to the new JFM spec.
+
2018-01-21 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
* ptex-base.ch: New primitives: \ptexversion, \ptexminorversion
diff --git a/Build/source/texk/web2c/ptexdir/pdvitype.ch b/Build/source/texk/web2c/ptexdir/pdvitype.ch
index 7090b09a786..8ce48c12d6b 100644
--- a/Build/source/texk/web2c/ptexdir/pdvitype.ch
+++ b/Build/source/texk/web2c/ptexdir/pdvitype.ch
@@ -133,8 +133,8 @@ lh:=b2*256+b3;
for k:=1 to nt do
begin
read_tfm_word;
- jfm_char_code[jfm_char_type_count]:=b0*256+b1;
- jfm_char_type[jfm_char_type_count]:=b2*256+b3;
+ jfm_char_code[jfm_char_type_count]:=b0*256+b1+b2*65536;
+ jfm_char_type[jfm_char_type_count]:=b3;
jfm_char_font[jfm_char_type_count]:=nf;
jfm_h:= { hash value }
(jfm_char_code[jfm_char_type_count]+nf) mod jfm_hash_size;
diff --git a/Build/source/texk/web2c/ptexdir/ppltotf.ch b/Build/source/texk/web2c/ptexdir/ppltotf.ch
index a3bb0e3c48d..cb2d61ac258 100644
--- a/Build/source/texk/web2c/ptexdir/ppltotf.ch
+++ b/Build/source/texk/web2c/ptexdir/ppltotf.ch
@@ -1,5 +1,6 @@
% This is a change file for PLtoTF
%
+% (2018-01-27) HY pPLtoTF p2.0 - new JFM spec by texjporg
% (07/18/2006) ST PLtoTF p1.8 (3.5, Web2c 7.2)
% (11/13/2000) KN PLtoTF p1.4 (3.5, Web2c 7.2)
% (03/27/1998) KN PLtoTF p1.3 (3.5, Web2c 7.2)
@@ -15,7 +16,7 @@
@d banner=='This is PLtoTF, Version 3.6' {printed when the program starts}
@y
@d my_name=='ppltotf'
-@d banner=='This is pPLtoTF, Version 3.6-p1.8'
+@d banner=='This is pPLtoTF, Version 3.6-p2.0'
{printed when the program starts}
@z
@@ -230,6 +231,13 @@ else
memory[italic]+nl+lk_offset+nk+ne+np;
@z
+@x [131] pTeX:
+@ @d out_size(#)==out((#) div 256); out((#) mod 256)
+@y
+@ @d out_size(#)==out((#) div 256); out((#) mod 256)
+@d out_kanji_code(#)==out_size((#) mod 65536); out((#) div 65536)
+@z
+
@x [131] l.2256 - pTeX:
out_size(lf); out_size(lh); out_size(bc); out_size(ec);
out_size(memory[width]); out_size(memory[height]);
@@ -572,13 +580,23 @@ skip_to_paren;
end
@ Next codes used to write |kanji_type| to \.{JFM}.
+In the original JFM spec by ASCII Corporation, |jis_code| and |char_type|
+were packed into upper (2~bytes) and lower (2~bytes) halfword respectively.
+However, |char_type| is allowed only 0..255,
+so the upper byte of lower halfword was always 0.
+
+In the new JFM spec by texjporg, |jis_code| ``XXyyzz'' is packed into
+first 3~bytes in the form ``yy zz XX'', and |char_type| is packed into
+remaining 1~byte. The new spec is effectively upper compatible with
+the original, and it allows |jis_code| larger than 0x10000 (not really
+useful for me \.{pPLtoTF} but necessary for \.{upPLtoTF}).
@<Output the kanji character type info@>=
begin out_size(0); out_size(0); { the default }
for kanji_type_index:=0 to max_kanji do
begin if kanji_type[kanji_type_index]>0 then
- begin out_size(index_to_jis(kanji_type_index));
- out_size(kanji_type[kanji_type_index]);
+ begin out_kanji_code(index_to_jis(kanji_type_index));
+ out(kanji_type[kanji_type_index]);
if verbose then begin
print('char index = ', kanji_type_index);
print(' (jis ');
@@ -616,7 +634,7 @@ else begin skip_error('This expression is out of JIS-code encoding.');
end;
@#
procedure print_jis_hex(jis_code:integer); {prints jiscode as four digits}
-var dig:array[0..4] of byte; {holds jis hex codes}
+var dig:array[0..3] of byte; {holds jis hex codes}
i:byte; {index of array}
begin dig[0]:=Hi(jis_code) div 16; dig[1]:=Hi(jis_code) mod 16;
dig[2]:=Lo(jis_code) div 16; dig[3]:=Lo(jis_code) mod 16;
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index 9e77bf35372..61797a5123b 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -2720,6 +2720,22 @@ var k:font_index; {index into |font_info|}
@!cx:KANJI_code; {kanji code}
@z
+@x
+@d read_sixteen(#)==begin #:=fbyte;
+ if #>127 then abort;
+ fget; #:=#*@'400+fbyte;
+ end
+@y
+@d read_sixteen(#)==begin #:=fbyte;
+ if #>127 then abort;
+ fget; #:=#*@'400+fbyte;
+ end
+@d read_twentyfourx(#)==begin #:=fbyte;
+ fget; #:=#*@"100+fbyte;
+ fget; #:=#+fbyte*@"10000;
+ end
+@z
+
@x [30.565] l.11548 - pTeX: read tfm size
@ @<Read the {\.{TFM}} size fields@>=
begin read_sixteen(lf);
@@ -2830,8 +2846,8 @@ for k:=fmem_ptr to width_base[f]-1 do
if jfm_flag<>dir_default then
for k:=ctype_base[f] to ctype_base[f]+nt-1 do
begin
- fget; read_sixteen(cx); font_info[k].hh.rh:=tokanji(cx); {|kchar_code|}
- fget; read_sixteen(cx); font_info[k].hh.lhfield:=tonum(cx); {|kchar_type|}
+ fget; read_twentyfourx(cx); font_info[k].hh.rh:=tokanji(cx); {|kchar_code|}
+ fget; cx:=fbyte; font_info[k].hh.lhfield:=tonum(cx); {|kchar_type|}
end;
for k:=char_base[f]+bc to width_base[f]-1 do
begin store_four_quarters(font_info[k].qqqq);
diff --git a/Build/source/texk/web2c/ptexdir/ptftopl.ch b/Build/source/texk/web2c/ptexdir/ptftopl.ch
index c9c08c0588a..97e670d78db 100644
--- a/Build/source/texk/web2c/ptexdir/ptftopl.ch
+++ b/Build/source/texk/web2c/ptexdir/ptftopl.ch
@@ -1,5 +1,6 @@
% This is a change file for TFtoPL
%
+% (2018-01-27) HY pTFtoPL p2.0 - new JFM spec by texjporg
% (07/18/2006) ST TFtoPL p1.7 (3.1, Web2c 7.2)
% (03/27/1998) KN TFtoPL p1.4 (3.1, Web2c 7.2)
%
@@ -14,7 +15,7 @@
@d banner=='This is TFtoPL, Version 3.3' {printed when the program starts}
@y
@d my_name=='ptftopl'
-@d banner=='This is pTFtoPL, Version 3.3-p1.7'
+@d banner=='This is pTFtoPL, Version 3.3-p2.0'
{printed when the program starts}
@z
@@ -437,11 +438,12 @@ else
end;
end
-@ list the |char_type| table in a similar way to the type table
+@ list the |char_type| table in a similar way to the type table.
+The code is based on the new JFM spec by texjporg.
@d char_type(#)==4*(type_base+#) {here \#\ is an index, not a character}
-@d JIS_code(#)==tfm[char_type(#)+0]*@'400+tfm[char_type(#)+1] {JIS code from |char_type| table}
-@d JIS_type(#)==tfm[char_type(#)+2]*@'400+tfm[char_type(#)+3] {JIS type from |char_type| table}
+@d JIS_code(#)==tfm[char_type(#)+0]*@'400+tfm[char_type(#)+1]+tfm[char_type(#)+2]*@'400*@'400 {JIS code from |char_type| table}
+@d JIS_type(#)==tfm[char_type(#)+3] {JIS type from |char_type| table}
@<list |char_type| table@>=
this_code:=JIS_code(0);
@@ -475,7 +477,7 @@ for type_num:=1 to ec do
incr(type_count);
out_kanji(index_to_jis(kanji_index));
end;
- if type_count=0 then bad('type ', type_num:1, 'has no characters in it!');
+ if type_count=0 then bad('type ', type_num:1, ' has no characters in it!');
out_ln; right;
end;
@@ -491,7 +493,7 @@ for k:=@'40 to 255 do xchr[k]:=k;
@ @<declare kanji conversion functions@>=
procedure out_kanji(jis_code:integer); { prints a kanji character }
var @!cx:integer; {KANJI code}
-i:0..4; {index of array}
+i:0..3; {index of array}
begin@/
if charcode_format=charcode_octal then
begin cx:=jis_code; out('J '); {specify jiscode format}