[luatex] luatex - font encoding for type 1 fonts

Hans Hagen pragma at wxs.nl
Sat Jun 18 00:14:45 CEST 2016


On 6/17/2016 10:28 PM, Pali Rohár wrote:
> On Thursday 09 June 2016 22:44:56 Pali Rohár wrote:
>> Hello,
>>
>> how I can specify font encoding for specific type 1 font?
>>
>> E.g. font csr10 (stored in fonts/type1/public/cs/csr10.pfb) is in IL2
>> encoding which means that character č (Latin Small Letter C with caron)
>> is at position 232.
>>
>> Code 232 is invalid in UTF-8 and therefore I cannot enter it normally
>> for luatex. So for printing it I need to use sequence \char232, which
>> works.
>>
>> \font\csr=csr10
>> \csr\char232
>> \bye
>>
>> Is there any simple way to tell luatex font encoding table (unicode
>> character --> code in type 1 font)? So I could be able to write utf8
>> string "č" directly in text editor instead \char232.
>>
>> My very quick hack for this was changing catcode of č to 13 and then
>> defining macro č as \char232.
>>
>> \catcode`\č=\active
>> \defč{\char232}
>> \font\csr=csr10
>> \csrč
>> \bye
>>
>> But I would like to avoid changing catcode of unicode characters and fix
>> this at font level.
>>
>
> Hello, has anybody idea about this problem?

if you use those fonts indeed you need to map from input encoding to 
font encoding and active characters are the way to go then

the context distribution ships with plain font support in which case you 
can best use the lm fonts instead of csr (i can't even locate those files)

\font\csr=lmroman10-regular.otf:+liga;+kern at 10pt

% \font\csr=csr.afm:+liga;+kern at 10pt

\csr č \bye

and then somehging like:

luatex --fmt=luatex-plain \dump

luatex --fmt=luatex-plain yourfile.tex

(here i test plain code with:

mtxrun --script plain --make
mtxrun --script plain        yourfile.tex

but that assumes a context installation)

(alternatively you can write a simple font loader in lua that does the 
mapping)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the luatex mailing list