[Dev-luatex] Font id from csname?

Khaled Hosny khaledhosny at eglug.org
Sun Dec 13 14:21:03 CET 2009


Oops, forgot the attachment.

On Sun, Dec 13, 2009 at 02:29:26PM +0200, Khaled Hosny wrote:
> 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
>         end
>     end
>     return -1
> end
> 
> 
> Regards,
>  Khaled
> 
> -- 
>  Khaled Hosny
>  Arabic localiser and member of Arabeyes.org team
>  Free font developer

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Implement-font.id.patch
Type: text/x-diff
Size: 2520 bytes
Desc: not available
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20091213/d5e885fe/attachment.patch>
-------------- 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/d5e885fe/attachment.pgp>


More information about the dev-luatex mailing list