Is there a way to retrieve internal font id from its csname, either using lua or some tex hackary? Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
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())} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
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). Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
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 Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
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
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
On Mon, Dec 14, 2009 at 09:48:56AM +0100, Taco Hoekwater wrote:
Hi,
Khaled Hosny wrote:
Oops, forgot the attachment.
This patch is nicer than the more indirect approaches, so I have committed it which a small change.
Thanks. Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
Hi, Hans Hagen wrote:
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
not -> now
show up before that stable version is out
But actually, it is possible to get the id for a font: \directlua {local id = token.create("tenrm")[2]} This does not (currently) work when you ask for the recent \font and that font has never been selected yet as 'currently active' font (token.create() will return zero in [2] in that case, for the \nullfont), but it works for all other fonts. Best wishes, Taco
Taco Hoekwater wrote:
But actually, it is possible to get the id for a font:
\directlua {local id = token.create("tenrm")[2]}
This does not (currently) work when you ask for the recent \font and that font has never been selected yet as 'currently active' font
Never mind that, it works always. I confused myself with a bad test. Best wishes, Taco
participants (3)
-
Hans Hagen
-
Khaled Hosny
-
Taco Hoekwater