otest.tex 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. \catcode`\@=11
  2. \input ienc
  3. \input oenc
  4. \input fsel
  5. %\tracingfonts2
  6. \def\msg#1{\medskip\leftline{#1}\message{^^J^^J** #1}\ignorespaces}
  7. \msg{Copyright and registered}
  8. x\copyright\ x\registeredsymbol
  9. {\setfontencoding{T1}\setfontfamily{LMRoman}\selectfont
  10. x\copyright\ x\registeredsymbol}
  11. % Declare a test font family, with very different fonts (visually) for
  12. % OT1 and T1.
  13. \declarefontfamily TestFam 1000 1200
  14. \fontmapfamily TestFam OT1 CMSans
  15. \fontmapfamily TestFam T1 URWPalladio
  16. \fontmapfamily TestFam TS1 LMRoman
  17. \fontmapfamily TestFam OML CMRoman
  18. \fontmapfamily TestFam OMS CMRoman
  19. \fontmapfamily TestFam T2A LHRoman
  20. % Define some encoding-specific glyphs.
  21. \fenc@begin{OT1}
  22. \fAcc\a{19}% \'
  23. \fCmp\a e{\'e}
  24. \fCmp\a E{\f@restore@enc\'e}
  25. \fCmp\a g{\'g}
  26. \fCmp\a G{\f@restore@enc\'g}
  27. \fCmp\a m{\b{oo}}
  28. \fCmp\a M{\f@restore@enc\b{oo}}
  29. \fCmp\a n{\b \copyright}
  30. \fCmp\a N{\f@restore@enc\b \copyright}
  31. \fCmd\copyright{WrongEncoding}
  32. %
  33. \fenc@begin{OML}
  34. \fAcc\b{127}% \tieafter
  35. \catcode`\@=12
  36. \msg{Dollar, pounds, euro (in OT1)}
  37. \textdollar{\itshape\textdollar}
  38. {\bfseries\textdollar{\itshape\textdollar}}
  39. % There's no bold `ui' font, so we don't get a bold \pounds.
  40. \pounds{\itshape\pounds}
  41. {\bfseries\pounds{\itshape\pounds}}
  42. \euro{\itshape\euro}
  43. {\bfseries\euro{\itshape\euro}}
  44. \msg{Cache}
  45. % To see this test working, you must uncomment the messages in
  46. % \f@search@command and \f@search@composite (but this will break
  47. % accents, so for other test comment them out again).
  48. % The cache is global and does not depend on font shape.
  49. {\bf
  50. \textregistered\textless\'a\texttimes\'g \tieaccent{oo}
  51. \message{^^J*}
  52. }\quad
  53. \textregistered\textless\'a\texttimes\'g \tieaccent{oo}
  54. \message{^^J**}
  55. \documentencoding ISO-8859-1
  56. % Now the new cache will be filled because \documentencoding changed
  57. % the current font encoding list.
  58. {\bf
  59. \textregistered\textless\'a\texttimes\'g \tieaccent{oo}
  60. \message{^^J*}
  61. }\quad
  62. \textregistered\textless\'a\texttimes\'g \tieaccent{oo}
  63. \message{^^J**}
  64. \setfontencoding{T1}\setfontfamily{TestFam}\selectfont
  65. % Again, another cache because encodings list of TestFam is different
  66. % from that of CMRoman.
  67. {\bf
  68. \textregistered\textless\'a\texttimes\'g \tieaccent{oo} \CYRZH
  69. \message{^^J*}
  70. }\quad
  71. \textregistered\textless\'a\texttimes\'g \tieaccent{oo} \CYRZH
  72. \message{^^J**}
  73. % We are now in ISO-8859-1 input encoding and T1 encoding of TestFam.
  74. \msg{Accents}
  75. \'{}
  76. \'a
  77. \'ô
  78. \'\copyright
  79. \quad
  80. % |a| in T1 (the current encoding), the accent in OT1 (the only
  81. % encoding containing |\a|).
  82. \a a
  83. \a ô
  84. \a \copyright
  85. \quad
  86. % Argument of the accent can contain an expandable command (including
  87. % an active character) only as a first token. But even then, it's
  88. % best if it's the only token in the argument, because |\bf a| and
  89. % |\bfa| will not be distinguished by the cache.
  90. \a{\bf c}
  91. %\a{\bf ô}% Doesn't work.
  92. \def\boldohat{\bf ô}%
  93. \a\boldohat
  94. %\a{\bf \ae}% Doesn't work.
  95. \def\boldae{\bf\ae}%
  96. \a\boldae
  97. \msg{Composites}
  98. \'e
  99. \'g
  100. \quad
  101. % Improperly defined composite -- |\a e| does not restore the original
  102. % encoding before calling another glyph macro (|\'e|), which results
  103. % in |e| being typeset in the encoding of the |\a e| composite (OT1).
  104. \a e
  105. \a g
  106. % Now the original encoding is properly restored -- therefore |\'e|
  107. % is called from T1; since T1 contains the composite |\'e|, we get
  108. % that. For |\'g| we get an accent since there's no such composite.
  109. \a E
  110. \a G
  111. \quad
  112. % A more complex example with the actual accent coming from yet
  113. % another encoding.
  114. \a m
  115. \a M
  116. \quad
  117. % And now even the accent's argument is from a different encoding.
  118. \a n
  119. \a N
  120. \bye
  121. % Local variables:
  122. % compile-command: "tex --interact=nonstopmode otest.tex"
  123. % coding: latin-1
  124. % End: