[Dev-luatex] Font id from csname?

Khaled Hosny khaledhosny at eglug.org
Sun Dec 13 13:29:26 CET 2009

On Sun, Dec 13, 2009 at 12:37:00PM +0100, Hans Hagen wrote:
> Khaled Hosny wrote:
> >On Sun, Dec 13, 2009 at 11:52:29AM +0100, Hans Hagen wrote:
> >>Khaled Hosny wrote:
> >>>Is there a way to retrieve internal font id from its csname, either using
> >>>lua or some tex hackary?
> >>{\somefont \directlua{tex.write(font.current())}
> >
> >Yup, I know about font.current(), but this means I've to activate the
> >font first which is not some thing I can do (I need this for fontspec;
> >I want to access the font table of a certain defined font that I only
> >know it csname).
> i remember that when a while ago taco and i discussed this that
> there were some good reasons for not yet having access to all this
> specific info i.e. i can imagine that tex.somefontcs returns the
> number but quite some of those accessors have to wait till the whole
> global/local issue of the code is resolved.
> also, we're not close to 0.50 so it's unlikely that new accessors
> will show up before that stable version is out

Any way, I tried to implement a font.id() last night, but didn't get it
to work. I get it to work finally (patch attached, in case anyone
interested), just to discover tex.fontidentifier() (what an odd place, I
was only looking under font library!) that can be used to implement the
function I want:

function font_id(str)
    for i=font.max(),0,-1 do
        if tex.fontidentifier(i) == str then
            return i
    return -1


 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20091213/45e37a22/attachment.pgp>

More information about the dev-luatex mailing list