ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Luatex question
@ 2011-10-25 12:09 Lutz Haseloff
  2011-10-25 12:15 ` luigi scarso
  2011-10-25 12:27 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Lutz Haseloff @ 2011-10-25 12:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

some months ago I printed the name of the current font with following code:

\starttext
The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
\stoptext

Now I get an error message:

! LuaTeX error <main ctx instance>:1: no string to print
stack traceback:
	[C]: in function 'print'
	<main ctx instance>:1: in main chunk.
l.2 ...int(font.getfont(font.current()).fullname)}
                                                  .
?

What is the right way now?
(didn't find any news in functionref.pdf or luatexref-t.pdf)

Greetings Lutz
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Luatex question
  2011-10-25 12:09 Luatex question Lutz Haseloff
@ 2011-10-25 12:15 ` luigi scarso
  2011-10-25 12:27 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: luigi scarso @ 2011-10-25 12:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Oct 25, 2011 at 2:09 PM, Lutz Haseloff
<lutz.haseloff@googlemail.com> wrote:
> Hi all,
>
> some months ago I printed the name of the current font with following code:
>
> \starttext
> The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
> \stoptext
>
> Now I get an error message:
>
> ! LuaTeX error <main ctx instance>:1: no string to print
> stack traceback:
>        [C]: in function 'print'
>        <main ctx instance>:1: in main chunk.
> l.2 ...int(font.getfont(font.current()).fullname)}
>                                                  .
> ?
>
> What is the right way now?
> (didn't find any news in functionref.pdf or luatexref-t.pdf)
Not the answer, but
in the suite  there is a pdf with a list :
status-lua.pdf


-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Luatex question
  2011-10-25 12:09 Luatex question Lutz Haseloff
  2011-10-25 12:15 ` luigi scarso
@ 2011-10-25 12:27 ` Hans Hagen
  2011-10-25 13:04   ` Lutz Haseloff
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2011-10-25 12:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 25-10-2011 14:09, Lutz Haseloff wrote:
> Hi all,
>
> some months ago I printed the name of the current font with following code:
>
> \starttext
> The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
> \stoptext
>
> Now I get an error message:
>
> ! LuaTeX error<main ctx instance>:1: no string to print
> stack traceback:
> 	[C]: in function 'print'
> 	<main ctx instance>:1: in main chunk.
> l.2 ...int(font.getfont(font.current()).fullname)}
>                                                    .
> ?
>
> What is the right way now?
> (didn't find any news in functionref.pdf or luatexref-t.pdf)

In order of efficiency (most efficient on top):

\starttext

\ctxlua{tex.print(fonts.hashes.properties[font.current()].fullname)}
 
\ctxlua{tex.print(fonts.hashes.identifiers[font.current()].properties.fullname)}

\ctxlua{tex.print(font.getfont(font.current()).properties.fullname)}

\stoptext

the font.getfont returns the table that tex gets passed and in context 
that table gets normalized, in the sense that variables are collected in 
'properties' and 'parameters'

in general, don't use font.getfont() in context as in the worst case it 
will rebuild a lua table at the tex

in the current beta you can run s-fnt-35.mkiv to see how this works

(this file will be renamed in a next beta)

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Luatex question
  2011-10-25 12:27 ` Hans Hagen
@ 2011-10-25 13:04   ` Lutz Haseloff
  0 siblings, 0 replies; 4+ messages in thread
From: Lutz Haseloff @ 2011-10-25 13:04 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

Thank you for your detailed information.

2011/10/25 Hans Hagen <pragma@wxs.nl>:
> On 25-10-2011 14:09, Lutz Haseloff wrote:
>>
>> Hi all,
>>
>> some months ago I printed the name of the current font with following
>> code:
>>
>> \starttext
>> The current font is:
>> \ctxlua{tex.print(font.getfont(font.current()).fullname)}.
>> \stoptext
>>
>> Now I get an error message:
>>
>> ! LuaTeX error<main ctx instance>:1: no string to print
>> stack traceback:
>>        [C]: in function 'print'
>>        <main ctx instance>:1: in main chunk.
>> l.2 ...int(font.getfont(font.current()).fullname)}
>>                                                   .
>> ?
>>
>> What is the right way now?
>> (didn't find any news in functionref.pdf or luatexref-t.pdf)
>
> In order of efficiency (most efficient on top):
>
> \starttext
>
> \ctxlua{tex.print(fonts.hashes.properties[font.current()].fullname)}
>
> \ctxlua{tex.print(fonts.hashes.identifiers[font.current()].properties.fullname)}
>
> \ctxlua{tex.print(font.getfont(font.current()).properties.fullname)}
>
> \stoptext
>
> the font.getfont returns the table that tex gets passed and in context that
> table gets normalized, in the sense that variables are collected in
> 'properties' and 'parameters'
>
> in general, don't use font.getfont() in context as in the worst case it will
> rebuild a lua table at the tex
>
> in the current beta you can run s-fnt-35.mkiv to see how this works
>
> (this file will be renamed in a next beta)
>
> Hans
>
>
>
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
> -----------------------------------------------------------------
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-25 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 12:09 Luatex question Lutz Haseloff
2011-10-25 12:15 ` luigi scarso
2011-10-25 12:27 ` Hans Hagen
2011-10-25 13:04   ` Lutz Haseloff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).