[lltx] [luatex] Patching fonts with the luaotfload callback "luaotfload.patch_font"

Ulrike Fischer news3 at nililand.de
Mon Mar 14 11:53:16 CET 2011


Am Mon, 14 Mar 2011 09:54:31 +0100 schrieb Taco Hoekwater:

> On 03/11/2011 01:53 PM, Ulrike Fischer wrote:
>> Am Sun, 06 Feb 2011 10:25:06 +0100 schrieb Taco Hoekwater:
>>
>> [About virtual fonts and tounicode entries]
>>
>>>> The tounicode entries still don't work as expected; hopefully Taco can enlighten us.
>>>
>>> tounicode (and the PDF /ToUnicode feature) works on the font glyphs
>>> that are actually included in the pdf, that is why it does not work. In
>>> the virtual font, it does notwork because there is no actual glyph, and
>>> in the original is works 'too well' as both 'a' and 'b' use the same
>>> glyph.
>>
>> I have now a working virtual font which reencodes a chess font. But
>> I'm still struck how to manipulate the tounicode values. I have now
>> put various combinations of XXX.characters[YY].tounicode=ZZ  in
>> various places and nothing works. Can you tell me what I should do?
> 
> It does not work because the _real_ font needs tounicode values. As I
> wrote earlier: tounicode works on actual glyphs, not virtual glyphs:

Yes, I did understand this. But it doesn't help if you don't _how_
to actually change the tounicode of the actual glyphs instead of the
virtual glyph ;-). I did put e.g. the tounicode command directly
after I loaded the "real" font and this didn't work either. (The
problem is also that I didn't know the correct format for the value.
So they was a lot of possible combinations I had to test.)


Thanks for your code, I will test it later. I also found another
possibility: I can set a /ActualText in the pdf:

           chars[u].commands = {
            {'special', 'pdf:literal BT /Span
<</ActualText<FEFF'..tounicodes[u]..'>>> BDC'},
            { 'char', v },
            {'special','pdf:literal  EMC ET'}}

This works fine, allows more freedom for the replacement text (and
seems even to work in right-to-left text).

(I'm not quite sure yet if the ":literal" and the BT-ET pair is
actually needed.)


-- 
Ulrike Fischer 



More information about the lualatex-dev mailing list