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

Taco Hoekwater taco at elvenkind.com
Mon Mar 14 09:54:31 CET 2011


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:

        -- u=target, v=source
        local real = font.fonts[id1]
        for u, v in next, reencoding do
            local c = chars[v]
             chars[u].commands = {{ 'char', v }}
             chars[u].kerns    = nil
             chars[u].width    = c.width
             chars[u].height   = c.height
             chars[u].depth    = c.depth
             chars[u].italic   = nil
             real.characters[v].tounicode = string.format("%04x",u)
        end
        font.fonts[id1] = real;

Best wishes,
Taco


More information about the luatex mailing list