[Dev-luatex] Chars to glyphs. How to?
Jonathan Sauer
Jonathan.Sauer at silverstroke.com
Wed Dec 5 12:26:22 CET 2007
Hello,
thanks for your quick and detailed reply!
> [...]
> > Given the letter "ä" and a font in OT1-encoding,
> > how would I convert this "ä" to an accented glyph *after*
> > hyphenation has happened (to be able to hyphenate words
> > containing "ä")?
>
> The logical place is in the ligaturing callback, because
> for tfm-based fonts, the actual ligature insertions can be
> done in one line via the node.ligaturing() built-in function.
>
> [...]
>
> Note: you don't have to worry about return values because the head
> node that is passed on to the callback is guaranteed not to be a
> glyph_node (if need be, a temporary node will be inserted), and
> therefore it cannot be affected by the mutations that take place.
> In this case, the 'tail' node is not used (the link of 'tail' is
> guaranteed to be 'nil').
You mean if I insert additional nodes inbetween? If I only modify
the nodes themselves without touching the list, this should not be
a problem anyway.
> You have to write the convert_to_glyphs function of course,
> and it could look like this:
>
> \directlua0{
> function find_font_glyph (f,c)
> % you should do some real work here!
> return c
> end
>
> function convert_to_glyphs (head)
> for v in node.traverse_id(head) do
> if v.subtype=1 then
> v.character = find_font_glyph(v.font,v.character)
> v.subtype=0
> end
> end
> end
> }
Shouldn't the subtype be "2"? In setion 7.1.2.12, bit 1 is used
to denote a glyph, if I understand the manual correctly. Since
I convert the character to a glyph in the font, this bit should
be set afterwards.
Also, in the manual the field is called "char", not "character".
Which one is correct? (both?)
Anyway, now I have a place where to start. Still, I am a bit
clueless on how to create an accented character node. Or do I
have to insert another character node in the list containing
the accent (i.e. '"' to create an 'ä' from an 'a')? How do I
tell this new node to overlap the 'a'?
> Best wishes,
> Taco
Thanks in advance,
Jonathan
More information about the dev-luatex
mailing list