Changes

Jump to navigation Jump to search
m
Text replacement - "<cmd>" to "{{cmd|"
< [[Fonts]] >
==Introduction==
If you write ConTeXt source documents and use more than 7-bit ASCII, you must decide on the encoding of your file. That’s a matter of your text editor.
The best choice is normally UTF-8, but if you insist to use an outdated editor that can’t handle Unicode properly or if you’re forced to use legacy code, you have to choose the proper 8-bit encoding, see below.
 
=== Testing for UTF-8-aware TeX ===
 
To test for [[LuaTex]], one may test if <code>\directlua</code> is defined.
 
The next weird macro definition should work for testing XeTeX/LuaTex, because only XeTeX and LuaTex accept 5- and 6-byte caret notation (hex 22 == double quote):
<texcode>
\def\"{0}\expandafter\def\csname^^^^^00022\endcsname{1}
\ifnum\"=0 \message{tex82}\else\message{newstuff}\fi
</texcode>
 
But that is not quite the same as testing for native UTF-8. Better is a trick like this:
 
<texcode>
\def\test#1#2!{\def\secondarg{#2}}
\test χ!\relax % That's Chi, a 2-byte utf-8 sequence
\ifx\secondarg\empty \message{newstuff}\else \message{tex82}\fi
</texcode>
 
ConTeXt offers <code>\beginNEWTEX ... \endNEWTEX</code> to process code conditional on using LuaTeX or XeTeX.
===Available Regimes===
 
<table style="border:1px solid #DDDDDD">
<tr style="background-color:#DDDDDD"><th>ConTeXt name(s)</th><th>Official name(s)</th><th>Remarks</th></tr>
* [http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/] for Windows
You enable such a regime with <{{cmd>|enableregime</cmd>}}<code>[some]</code>, preferably in your [[Project_structure|environment file]].
===Typesetting in UTF-8===
Use <{{cmd>|enableregime</cmd>}}<code>[utf]</code> in order to be able to typeset in Unicode under ConTeXt MkII. (This is '''not''' necessary in MkIV, as it is enabled by default using LuaTeX.)
Unfortunately you must save your UTF-8 encoded files '''without BOM''' (byte order mark), because ConTeXt (or pdfTeX) doesn't ignore that but typesets the characters.
====How do I know which glyph name to use?====
* Under mkii, use <{{cmd>|showcharacters</cmd>}}* Consult the [http://partners.adobe.com/public/developer/en/opentype/aglfn13.txt Adobe glyph list]* browse the ConTeXt [[source:enco-acc.tex|sourceenco-acc.tex]], {{src|enco-acc.mkii}}, or {{src|char-def.lua}}. (Warning: The lua file is 3.6 MB large and contains nearly 180,000 lines.)
<context mode=mkii source="yes">
\showcharacters
</context>
* [http://www.jw-stumpel.nl/stestu.html Multilingual text on Linux] : A good guide on how to configure and use UTF-8 support on linux.
[[Category:Fonts]][[Category:InternationalOld Content]]

Navigation menu