O/T : linux: can I list which small caps are in a ttf/otf font ?

Herbert Voss Herbert.Voss at fu-berlin.de
Thu Oct 26 08:52:15 CEST 2023



Am 26.10.23 um 00:46 schrieb Peter Flynn:
> On 25/10/2023 22:40, Karl Berry wrote:
>> pf> I believe fontforge is able to dump all the metadata from a font
>> pf> file,
>>
>> Just to mention, for dumping data from otf/ttf, I have had good luck 
>> with ttx from "fonttools". https://github.com/fonttools/fontools
>
> I had utterly forgotten ttx, thanks.

you can also list the fonts with lualatex:

\documentclass[a4paper]{article}
\usepackage{luacode}
\usepackage[margin=0.5cm]{geometry}
\usepackage{libertinus-otf}
\usepackage{multicol}
\setlength{\columnsep}{0.3cm} \setlength{\columnseprule}{1pt}

\newfontface\FiraSC{FiraSans-Regular.otf}[RawFeature=+c2sc]   %
\begin{document}

\begin{multicols}{4}\noindent
\begin{luacode*}
     local f = fontloader.open('/tmp/FiraSans-Regular.otf') -- the test font
     local glyphs = {}
     for i = 0, f.glyphmax - 1 do
         local g = f.glyphs[i]
       if g then
         table.insert(glyphs, {name = g.name, unicode = g.unicode})
       end
     end
     table.sort(glyphs, function (a,b) return (a.unicode < b.unicode) end)
     for i = 1, #glyphs do
       tex.sprint(glyphs[i].unicode .. ": ")
       if glyphs[i].name:match("^.+(%..+)$") == ".sc" then
         if glyphs[i].unicode > 0 then
             tex.sprint("{\\FiraSC\\char" .. glyphs[i].unicode .. 
"\\relax}")
         else
tex.sprint("{\\FiraSC\\char\\directlua{tex.print(luaotfload.aux.slot_of_name(font.current(), 
[["
                 .. glyphs[i].name .. "]]))}}")
            end
           tex.print(" { \\small\\space(")
         tex.print(-2, glyphs[i].name)
         tex.sprint(')}\\\\')
       end
     end
     fontloader.close(f)
\end{luacode*}
\end{multicols}

\end{document}


lists all glyphs with extension .cs

Herbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2023-10-26 um 08.44.33.png
Type: image/png
Size: 124905 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-live/attachments/20231026/38dea489/attachment-0001.png>


More information about the tex-live mailing list.