[luatex] protect_glyph
luigi scarso
luigi.scarso at gmail.com
Mon Jul 4 13:46:16 CEST 2011
On Mon, Jul 4, 2011 at 1:35 PM, Taco Hoekwater <taco at elvenkind.com> wrote:
> On 07/04/2011 12:48 PM, luigi scarso wrote:
>>
>> On Mon, Jul 4, 2011 at 12:24 PM, Patrick Gundlach<patrick at gundla.ch>
>> wrote:
>>>>
>>>> and why 256 is important for it ?
>>>
>>> good question. The bit field has only 4 bits, so 256 makes no sense for
>>> me.
>>
>> 5 bits, see luatexdir/tex/texnodes.h
>
> protect_glyph/unprotect_glyph is a bit of an odd thing that was
> added as a speedup (helper) for lua node processing in ConTeXt.
> It has its uses, but nevertheless its existence is debatable, and
> we may come up with something else in the end. (it exists to
> separate characters that have been processed into glyphs from
> glyphs there added directly as glyphs, the value '256' is just
> to get some distance away from bit 5).
yes,I also though so.
The fact is that there was a bit of confusion between the source and the ref. :
for example for protect_glyph the ref. says
""
Adds 256 to all glyph node subtypes in the node list starting at n,
except that if the value is 1, it adds
only 255. The special handling of 1 means that characters will become
glyphs after subtraction of
256.
""
The code says the same, but in slightly differ manner
if (s <= 256) {
t = 1;
subtype(head) = (quarterword) (s == 1 ? 256 : 256 + s);
}
Maybe this sounds better
""
Adds 256 to all glyph node subtypes in the node list starting at n,
except that if the value is 1 then the node subtype is 256. The
special handling of 1 means that characters will become glyphs after
subtraction of
256.
""
But it's almost irrelevant.
--
luigi
More information about the luatex
mailing list