[luatex] emulating \XeTeXglyph
Janusz S. Bień
jsbien at mimuw.edu.pl
Sun Nov 3 14:58:43 CET 2024
On Sun, Nov 03 2024 at 14:55 +01, Janusz S. Bień wrote:
> On Sun, Nov 03 2024 at 13:52 GMT, David Carlisle wrote:
>> it's essentially the same code as you used (Henri provided both)
>> sorry no time now, and I don't have the font but you are free to compare the versions and see if Henri changed anything in each version.
>
> OK.
>
> Does anybody on this list have an idea why the emulation fails only for
> one specific font slot?
>
> Regards - Janusz
>
>>
>> David
>>
>> On Sun, 3 Nov 2024 at 13:33, Janusz S. Bień <jsbien at mimuw.edu.pl> wrote:
>>
>> On Sun, Nov 03 2024 at 13:19 GMT, David Carlisle wrote:
>> > your question isn't very clear (what emulation isn't working?)
>>
>> Thanks for you answer!
>>
>> From the source code of the sample files at https://github.com/jsbien/tmpLuaLaTeX:
>>
>> % Karl Berry
>> % Production notes
>> % TUGboat volume 44, number 1 (2023), page 115
>> % https://tug.org/TUGboat/tb44-1/tb136prod.pdf
>> % DOI (this page): 10.47397/tb/44-1/tb136prod
>> % a bit of Lua code which written by Henri Menke
>> % (thank you Henri, and thank you search engines), which emulates many
>> % \XeTeX\ primitives in Lua\TeX\
>> % (\url{https://gist.github.com/hmenke/6e8ff7c90a5e5df3c4895f60059a2ef7}):
>>
>> The actual code is
>>
>> \def\XeTeXglyph{%
>> \directlua{
>> local index = token.scan_int()
>> local tfmdata = font.getfont(font.current())
>> if tfmdata.format ~= "opentype" and tfmdata.format ~= "truetype" then
>> tex.error("Cannot use \\XeTeXglyph with " .. tfmdata.name .. " format " .. tfmdata.format)
>> end
>> local found = false
>> for slot, char in pairs(tfmdata.characters) do
>> if char.index == index then
>> tex.print(utf.char(char.unicode))
>> found = true
>> break
>> end
>> end
>> if not found then
>> texio.write_nl("Glyph " .. index .. " not found in " .. tfmdata.name)
>> end
>> }
>> }
>>
>> It works e.g. for \XeTeXglyph21188 but not for \XeTeXglyph16990. Both
>> work in XeTeX, so it doesn't seem a font problem. The font is
>> NishikiTeki-MVxaJ.ttf from
>> https://www.fontspace.com/nishiki-teki-font-f86893.
>>
>> > but there is a Lua emulation (not that well tested) for the xetex
>> > glyph index commands available at
>> > https://github.com/latex3/xxetex/blob/main/xxetex.lua#L81 and
>> > surrounding code.
>>
>> I will happy to test it, but I need some fool-proof instructions how to
>> use it in LuaLaTeX.
>>
>> Regards - Janusz
>>
>> >
>> > David
>> >
>> > On Sun, 3 Nov 2024 at 12:46, Janusz S. Bień <jsbien at mimuw.edu.pl> wrote:
>> >
>> > Hi!
>> >
>> > I have encountered a strange problem:
>> >
>> > https://github.com/jsbien/tmpLuaLaTeX/issues
>> >
>> > I can live with it, but perhaps it is a manifestation of some more
>> > interesting problem.
>> >
>> > It's quite possible I'm doing something stupid... Anyway
>> > ChatGPT/AskTheCode was unable to help.
>> >
>> > Best regards
>> >
>> > Janusz
>> >
>> > --
>> > ,
>> > Janusz S. Bien
>> > emeryt (emeritus)
>> > https://sites.google.com/view/jsbien
>> >
>>
>> --
>> ,
>> Janusz S. Bien
>> emeryt (emeritus)
>> https://sites.google.com/view/jsbien
>>
--
,
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien
More information about the luatex
mailing list.