Donald E. Knuth has included a complete list of the syntax and semantics of DVI commands (opcode, symbolic name, number of parameters, meaning) in Computers & Typesetting Vol. E, §585, pp. 236–239. Where I can find a similar list for the additional commands in the 250–255 range, used by XeTeX?
Available information
Here is what I got (the information comes from https://github.com/simoncozens/dvipdfm-x/blob/libtexpdf/dvicodes.h):
- begin_reflect 250. (No parameters???) TeX-XeT begin reflect
- end_reflect 251. (No parameters???) TeX-XeT end reflect
- xdv_native_font_def 252. Parameters??? Syntax???
- xdv_glyphs 253. Parameters??? Possible values???
- ??? 254. ???
- ptexdir 255. Parameters??? Possible values???
Needless to say, the information in the dvicodes.h file is lacunary. Can anyone complete this? (meaning of each command, number of parameters—if any, list of possible values)
Trying to decypher
I opened a very simple XDV file, obtained from the following TeX code:
\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,hijricorrection=1,locale=mashriq]{arabic}
\setmainfont[Script=Arabic,Extension=.ttf]{Amiri-Regular}
\begin{document}
Bonjour\special{ligne x}
\begin{Arabic}يانيس\end{Arabic}
Bonjour
\end{document}
In the XDV file, some info is in specials (command xxx), that's fine. Then there is a xdv_native_font_def command followed (a) by the following bytes:
00 00 00 1E 00 0A 00 00 00 00
(b) by letter L
and the absolute path to the font, (c) another four 00
bytes. Then the font 30 is called (although it has not been defined in the standard fnt_def way).
Then comes a xdv_glyphs command, followed by 2 bytes: 00
and 1F
(???) and then another fnt_def command for font 50 (???) and then what looks like a lot of set_char commands for glyph 00
. Since I don't know the xdv_native_font_def syntax, I probably got it all wrong.
What is really strange is that the Bonjour
string of the file does never appear in the XDV file (contrarily to DVI files, where ASCII glyphs are assigned to opcodes having the numeric value of the ASCII position). Where the Bonjour
string should have been, there is this byte string:
00 25 00 52 00 51 00 4d 00 52 00 58 00 55
where I can only conclude that 0025
is letter B
(whose ASCII code is 0x42 and not 0x25), 0052
is letter o
(whose ASCII code is 0x6F and not 0x52). Where on Earth comes the assignment B → 0x25, o → 0x52 from?
The xdv_native_font_def command appears again in the postamble. Although part of the document is in right-to-left mode, I don't see anywhere the begin_reflect and end_reflect commands, but not knowing the xdv_native_font_def syntax probably scrambles my analysis of the whole XDV file.
So any help will be greatly welcome!
For those who have no Unix tools handy, here is the hexdumped test file:
00000000 f7 07 01 83 92 c0 1c 3b 00 00 00 00 03 e8 1d 20 |.......;....... |
00000010 58 65 54 65 58 20 6f 75 74 70 75 74 20 32 30 31 |XeTeX output 201|
00000020 39 2e 30 36 2e 31 36 3a 32 31 31 30 8b 00 00 00 |9.06.16:2110....|
00000030 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000050 00 00 00 00 00 ff ff ff ff ef 14 70 64 66 3a 70 |...........pdf:p|
00000060 61 67 65 73 69 7a 65 20 64 65 66 61 75 6c 74 a0 |agesize default.|
00000070 02 79 00 00 8d a0 fd a3 00 00 a0 02 3f 00 00 8d |.y..........?...|
00000080 a0 fd e4 00 00 8d 92 01 2c 53 40 ef 61 70 64 66 |........,S@.apdf|
00000090 3a 64 6f 63 69 6e 66 6f 3c 3c 2f 42 49 44 49 2e |:docinfo<</BIDI.|
000000a0 46 75 6c 6c 62 61 6e 6e 65 72 28 54 68 69 73 20 |Fullbanner(This |
000000b0 69 73 20 74 68 65 20 62 69 64 69 20 70 61 63 6b |is the bidi pack|
000000c0 61 67 65 2c 20 56 65 72 73 69 6f 6e 20 33 35 2e |age, Version 35.|
000000d0 37 2c 20 52 65 6c 65 61 73 65 64 20 4d 61 72 63 |7, Released Marc|
000000e0 68 20 33 2c 20 32 30 31 39 2e 20 29 3e 3e 96 02 |h 3, 2019. )>>..|
000000f0 ee 00 fc 00 00 00 1e 00 0a 00 00 00 00 13 2e 2f |.............../|
00000100 41 6d 69 72 69 2d 52 65 67 75 6c 61 72 2e 74 74 |Amiri-Regular.tt|
00000110 66 00 00 00 00 c9 fd 00 1f dd 80 00 07 00 00 00 |f...............|
00000120 00 00 00 00 00 00 05 d2 00 00 00 00 00 00 0a 98 |................|
00000130 80 00 00 00 00 00 0f ca 80 00 00 00 00 00 12 20 |............... |
00000140 00 00 00 00 00 00 17 18 80 00 00 00 00 00 1c 20 |............... |
00000150 00 00 00 00 00 00 25 00 52 00 51 00 4d 00 52 00 |......%.R.Q.M.R.|
00000160 58 00 55 93 fd 00 13 27 c0 00 05 00 00 00 00 00 |X.U....'........|
00000170 00 00 00 00 0a ca 80 00 00 00 00 00 0d 3b 80 00 |.............;..|
00000180 00 00 00 00 0e f4 c0 00 00 00 00 00 11 40 40 00 |.............@@.|
00000190 00 00 00 06 5e 0e 9b 0e 7c 04 ef 05 2d 93 ef 07 |....^...|...-...|
000001a0 6c 69 67 6e 65 20 78 fd 00 1f dd 80 00 07 00 00 |ligne x.........|
000001b0 00 00 00 00 00 00 00 05 d2 00 00 00 00 00 00 0a |................|
000001c0 98 80 00 00 00 00 00 0f ca 80 00 00 00 00 00 12 |................|
000001d0 20 00 00 00 00 00 00 17 18 80 00 00 00 00 00 1c | ...............|
000001e0 20 00 00 00 00 00 00 25 00 52 00 51 00 4d 00 52 | ......%.R.Q.M.R|
000001f0 00 58 00 55 8e 8e 9f 1e 00 00 8d 92 00 e7 92 00 |.X.U............|
00000200 fd 00 05 dc 00 00 01 00 00 00 00 00 00 00 00 01 |................|
00000210 be 8e 8e 8c f8 00 00 00 2c 01 83 92 c0 1c 3b 00 |........,.....;.|
00000220 00 00 00 03 e8 02 79 f2 7f 01 97 00 00 00 03 00 |......y.........|
00000230 01 fc 00 00 00 1e 00 0a 00 00 00 00 13 2e 2f 41 |............../A|
00000240 6d 69 72 69 2d 52 65 67 75 6c 61 72 2e 74 74 66 |miri-Regular.ttf|
00000250 00 00 00 00 f9 00 00 02 14 07 df df df df df df |................|
00000260