I'm using Brill-Roman.otf
font and with luatex I don't know how to access smallcaps glyphs from virtual fontloader.to_table
returned table glyphs
. There is no such index and I have no idea how to get that glyphs data.
In Brill-Roman.lua
there is such glyph (smallcaps D
):
[983164]={
["boundingbox"]=804,
["index"]=1146,
["name"]="D.c2sc",
["unicode"]=68,
["width"]=559,
},
NWE
\documentclass{article}
\usepackage{luacode}
\usepackage{fontspec}
\setmainfont[
Extension=.otf,
UprightFont=*-Roman,
UprightFeatures={
SizeFeatures={
{ Size={9-},
SmallCapsFeatures={Letters=UppercaseSmallCaps,LetterSpace=5.0},
WordSpace={1,1.5,0.6}
}
}
}
]{Brill}
\begin{luacode*}
local function get_real_char(font_idx, glyph_idx)
local real_font = font.getfont(font_idx)
local myfont = fontloader.open(real_font.filename)
if myfont then
metrics = fontloader.to_table(myfont)
print ("IS_IT?", metrics.glyphs[glyph_idx])
fontloader.close(myfont)
end
end
function print_glyph(h)
for n in node.traverse(h) do
if n.id == node.id("glyph") then
print ("GLYPH:", n.char, n.font)
get_real_char(n.font, n.char)
elseif n.id == node.id("hlist") or n.id == node.id("vlist") then
print_glyph(n.head)
end
end
return h
end
luatexbase.add_to_callback("pre_output_filter", print_glyph, "print glyph")
\end{luacode*}
\begin{document}
\textsc{Data} font
\end{document}
And here is the output:
This is LuaTeX, Version 1.07.0 (TeX Live 2018/W32TeX)
(format=lualatex 2018.6.5) 10 JUL 2018 09:43
....
GLYPH: 983164 30
IS_IT? nil
GLYPH: 983574 30
IS_IT? nil
GLYPH: 983593 30
IS_IT? nil
GLYPH: 983574 30
IS_IT? nil
GLYPH: 102 29
IS_IT? table: 09814140
GLYPH: 111 29
IS_IT? table: 0D4A73B8
GLYPH: 110 29
IS_IT? table: 0E93DCF8
GLYPH: 116 29
IS_IT? table: 106CDC88
I printed out all the table returned by fontloader and there was nothing with 983164
, but there was a lot info with name D.c2sc
. It seems it is already remaped to some lookup tables. I don't see any possibilities to attache files here so I can't add that font.
Question how to get n.char
data (e.g. "name", "unicode") if it is not in fontloader returned virtual font table.