* "Trial typesetting" in ConTeXt / lua ?
@ 2015-11-14 10:16 josephcanedo
2015-11-17 8:15 ` josephcanedo
0 siblings, 1 reply; 11+ messages in thread
From: josephcanedo @ 2015-11-14 10:16 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 755 bytes --]
Dear all,
Is it possible in ConTeXt within lua code to do “trial typesetting” (not sure that’s best name for what I would like to achieve) ? By this I mean store some input (with text and macros) in some buffer and do what ConTeXt does normally (parsing, create nodes …) but instead of shipping the nodes to line breaking algorithm and to the page output, only retrieve the nodes and after discard them. This is to get an estimate of the total text width within a paragraph (to calculate some shape on the paragraph).
I browsed the lua code from http://source.contextgarden.net/ but I do not dare to use too low level lua functionality.
Many thanks for any hint (even a pointer to lua function).
Best regards
Joseph Canedo
[-- Attachment #1.2: Type: text/html, Size: 2044 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-14 10:16 "Trial typesetting" in ConTeXt / lua ? josephcanedo
@ 2015-11-17 8:15 ` josephcanedo
2015-11-17 22:09 ` josephcanedo
2015-11-18 1:46 ` Hans Hagen
0 siblings, 2 replies; 11+ messages in thread
From: josephcanedo @ 2015-11-17 8:15 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 1392 bytes --]
Hello,
I was wondering if someone could have some hints on this question, anyway, I found the function mknodes() from luaTeX wiki and nodes.handlers.characters(head) function in ConTeXt (as it seems that node.ligaturing(head) and node.kerning(head) do not seem to do anything).
It seems to work fine (ligatures and font features) expect the kerning. Does someone know how to perform the kerning as well ?
Best regards
Joseph Canedo
From: josephcanedo@gmail.com
Sent: Saturday, November 14, 2015 11:16 AM
To: ntg-context@ntg.nl
Dear all,
Is it possible in ConTeXt within lua code to do “trial typesetting” (not sure that’s best name for what I would like to achieve) ? By this I mean store some input (with text and macros) in some buffer and do what ConTeXt does normally (parsing, create nodes …) but instead of shipping the nodes to line breaking algorithm and to the page output, only retrieve the nodes and after discard them. This is to get an estimate of the total text width within a paragraph (to calculate some shape on the paragraph).
I browsed the lua code from http://source.contextgarden.net/ but I do not dare to use too low level lua functionality.
Many thanks for any hint (even a pointer to lua function).
Best regards
Joseph Canedo
[-- Attachment #1.2: Type: text/html, Size: 3406 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-17 8:15 ` josephcanedo
@ 2015-11-17 22:09 ` josephcanedo
2015-11-18 1:46 ` Hans Hagen
1 sibling, 0 replies; 11+ messages in thread
From: josephcanedo @ 2015-11-17 22:09 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 2044 bytes --]
Just in case it is of interest (and assuming this won’t change in future versions), after digging again in lua code I replaced nodes.handlers.characters(head) with
local proc = nodes.tasks.actions('processors') -- not sure finalizers tasks are needed ?
head = proc(head)
before passing returned head to linebreak:
local vbox, info = tex.linebreak(head, {})
node.write(vbox)
and it shows kern in ouput, apparently identical to vanilla typesetting.
Joseph
From: josephcanedo@gmail.com
Sent: Tuesday, November 17, 2015 9:15 AM
To: ntg-context@ntg.nl
Hello,
I was wondering if someone could have some hints on this question, anyway, I found the function mknodes() from luaTeX wiki and nodes.handlers.characters(head) function in ConTeXt (as it seems that node.ligaturing(head) and node.kerning(head) do not seem to do anything).
It seems to work fine (ligatures and font features) expect the kerning. Does someone know how to perform the kerning as well ?
Best regards
Joseph Canedo
From: josephcanedo@gmail.com
Sent: Saturday, November 14, 2015 11:16 AM
To: ntg-context@ntg.nl
Dear all,
Is it possible in ConTeXt within lua code to do “trial typesetting” (not sure that’s best name for what I would like to achieve) ? By this I mean store some input (with text and macros) in some buffer and do what ConTeXt does normally (parsing, create nodes …) but instead of shipping the nodes to line breaking algorithm and to the page output, only retrieve the nodes and after discard them. This is to get an estimate of the total text width within a paragraph (to calculate some shape on the paragraph).
I browsed the lua code from http://source.contextgarden.net/ but I do not dare to use too low level lua functionality.
Many thanks for any hint (even a pointer to lua function).
Best regards
Joseph Canedo
[-- Attachment #1.2: Type: text/html, Size: 4868 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-17 8:15 ` josephcanedo
2015-11-17 22:09 ` josephcanedo
@ 2015-11-18 1:46 ` Hans Hagen
2015-11-18 20:49 ` josephcanedo
1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2015-11-18 1:46 UTC (permalink / raw)
To: ntg-context
On 11/17/2015 9:15 AM, josephcanedo@gmail.com wrote:
> Hello,
>
> I was wondering if someone could have some hints on this question,
> anyway, I found the function mknodes() from luaTeX wiki and
> nodes.handlers.characters(head) function in ConTeXt (as it seems that
> node.ligaturing(head) and node.kerning(head) do not seem to do anything).
>
> It seems to work fine (ligatures and font features) expect the kerning.
> Does someone know how to perform the kerning as well ?
I'm not sure if i understand your issue.
traditional ligaturing and kerning is applied when a node list has fonts
using basemode
\starttext
\startluacode
local hbox = nodes.typesetters.hpack("Hello World!")
context("%p",hbox.width)
nodes.flush_list(hbox)
\stopluacode
\stoptext
> Best regards
>
> Joseph Canedo
>
> *From:* josephcanedo@gmail.com <mailto:josephcanedo@gmail.com>
> *Sent:* Saturday, November 14, 2015 11:16 AM
> *To:* ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>
>
> Dear all,
>
> Is it possible in ConTeXt within lua code to do “trial typesetting” (not
> sure that’s best name for what I would like to achieve) ? By this I mean
> store some input (with text and macros) in some buffer and do what
> ConTeXt does normally (parsing, create nodes …) but instead of shipping
> the nodes to line breaking algorithm and to the page output, only
> retrieve the nodes and after discard them. This is to get an estimate of
> the total text width within a paragraph (to calculate some shape on the
> paragraph).
you can assemble a list of characters and then do an hpack on them
> I browsed the lua code from http://source.contextgarden.net/
> <http://source.contextgarden.net/tex/context/base/node-ref.lua?search=nodecodes> but
> I do not dare to use too low level lua functionality.
>
> Many thanks for any hint (even a pointer to lua function).
>
> Best regards
>
> Joseph Canedo
>
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-18 1:46 ` Hans Hagen
@ 2015-11-18 20:49 ` josephcanedo
2015-11-18 21:22 ` Hans Hagen
0 siblings, 1 reply; 11+ messages in thread
From: josephcanedo @ 2015-11-18 20:49 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 4466 bytes --]
Hi Hans
First of all, thanks a lot for replying.
I tried your suggestion and it does not seem to work at least for fancy features in EB Garamond (historical liguratures and other features).
I also tried to pass the hbox to tex.linebreak() and got assertion failure in luatex.
Is there any code snippet available to show the full process in lua code (I mean up to shipping the result nodes to the page) ?
To give some background, I’d like to compute a parshape for some paragraphs for which I’d like some special shape. I thought that one idea was to build up the lua nodes from text (which has some occasional words with smaller or different font style), compute the width of text to figure out a first guess for parshape and then iterate on linebreak with different parshape settings to refine the first guess.
Thanks a lot,
Best regards
Joseph
From: Hans Hagen
Sent: Wednesday, November 18, 2015 2:46 AM
To: ntg-context@ntg.nl
On 11/17/2015 9:15 AM, josephcanedo@gmail.com wrote:
> Hello,
>
> I was wondering if someone could have some hints on this question,
> anyway, I found the function mknodes() from luaTeX wiki and
> nodes.handlers.characters(head) function in ConTeXt (as it seems that
> node.ligaturing(head) and node.kerning(head) do not seem to do anything).
>
> It seems to work fine (ligatures and font features) expect the kerning.
> Does someone know how to perform the kerning as well ?
I'm not sure if i understand your issue.
traditional ligaturing and kerning is applied when a node list has fonts
using basemode
\starttext
\startluacode
local hbox = nodes.typesetters.hpack("Hello World!")
context("%p",hbox.width)
nodes.flush_list(hbox)
\stopluacode
\stoptext
> Best regards
>
> Joseph Canedo
>
> *From:* josephcanedo@gmail.com <mailto:josephcanedo@gmail.com>
> *Sent:* Saturday, November 14, 2015 11:16 AM
> *To:* ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>
>
> Dear all,
>
> Is it possible in ConTeXt within lua code to do “trial typesetting” (not
> sure that’s best name for what I would like to achieve) ? By this I mean
> store some input (with text and macros) in some buffer and do what
> ConTeXt does normally (parsing, create nodes …) but instead of shipping
> the nodes to line breaking algorithm and to the page output, only
> retrieve the nodes and after discard them. This is to get an estimate of
> the total text width within a paragraph (to calculate some shape on the
> paragraph).
you can assemble a list of characters and then do an hpack on them
> I browsed the lua code from http://source.contextgarden.net/
> <http://source.contextgarden.net/tex/context/base/node-ref.lua?search=nodecodes> but
> I do not dare to use too low level lua functionality.
>
> Many thanks for any hint (even a pointer to lua function).
>
> Best regards
>
> Joseph Canedo
>
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
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
___________________________________________________________________________________
[-- Attachment #1.2: Type: text/html, Size: 7491 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-18 20:49 ` josephcanedo
@ 2015-11-18 21:22 ` Hans Hagen
2015-11-18 21:36 ` josephcanedo
0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2015-11-18 21:22 UTC (permalink / raw)
To: ntg-context
On 11/18/2015 9:49 PM, josephcanedo@gmail.com wrote:
> Hi Hans
>
> First of all, thanks a lot for replying.
>
> I tried your suggestion and it does not seem to work at least for fancy
> features in EB Garamond (historical liguratures and other features).
> I also tried to pass the hbox to tex.linebreak() and got assertion
> failure in luatex.
are you sure that you defined that font and that it's the current font?
> Is there any code snippet available to show the full process in lua code
> (I mean up to shipping the result nodes to the page) ?
no ... thousands of lines spread over many files
> To give some background, I’d like to compute a parshape for some
> paragraphs for which I’d like some special shape. I thought that one
> idea was to build up the lua nodes from text (which has some occasional
> words with smaller or different font style), compute the width of text
> to figure out a first guess for parshape and then iterate on linebreak
> with different parshape settings to refine the first guess.
just put stuff in vboxes and loop over that; at the tex end with calls
to lua
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-18 21:22 ` Hans Hagen
@ 2015-11-18 21:36 ` josephcanedo
2015-11-19 16:16 ` josephcanedo
0 siblings, 1 reply; 11+ messages in thread
From: josephcanedo @ 2015-11-18 21:36 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 2659 bytes --]
> are you sure that you defined that font and that it's the current font?
I’ll double check my code and may I send you a MWE if I can still not see the ligatures and stuff. I’ll try also with new beta (have not installed yet) just in case.
> just put stuff in vboxes and loop over that; at the tex end with calls to lua
Not sure I follow what you mean, sorry about this. I am quite a newbie in ConTeXt and in TeX more generally.
Thanks
Joseph
From: Hans Hagen
Sent: Wednesday, November 18, 2015 10:22 PM
To: ntg-context@ntg.nl
On 11/18/2015 9:49 PM, josephcanedo@gmail.com wrote:
> Hi Hans
>
> First of all, thanks a lot for replying.
>
> I tried your suggestion and it does not seem to work at least for fancy
> features in EB Garamond (historical liguratures and other features).
> I also tried to pass the hbox to tex.linebreak() and got assertion
> failure in luatex.
are you sure that you defined that font and that it's the current font?
> Is there any code snippet available to show the full process in lua code
> (I mean up to shipping the result nodes to the page) ?
no ... thousands of lines spread over many files
> To give some background, I’d like to compute a parshape for some
> paragraphs for which I’d like some special shape. I thought that one
> idea was to build up the lua nodes from text (which has some occasional
> words with smaller or different font style), compute the width of text
> to figure out a first guess for parshape and then iterate on linebreak
> with different parshape settings to refine the first guess.
just put stuff in vboxes and loop over that; at the tex end with calls
to lua
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
___________________________________________________________________________________
[-- Attachment #1.2: Type: text/html, Size: 5332 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-18 21:36 ` josephcanedo
@ 2015-11-19 16:16 ` josephcanedo
2015-11-19 19:11 ` Hans Hagen
0 siblings, 1 reply; 11+ messages in thread
From: josephcanedo @ 2015-11-19 16:16 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 3021 bytes --]
Attached simple MWE. The second line has no ligatures/ no glyph substitution/ kern
Using: ConTeXt ver: 2015.10.09 21:28 MKIV beta fmt: 2015.11.1
Thanks
Best regards
Joseph
From: josephcanedo@gmail.com
Sent: Wednesday, November 18, 2015 10:36 PM
To: ntg-context@ntg.nl
> are you sure that you defined that font and that it's the current font?
I’ll double check my code and may I send you a MWE if I can still not see the ligatures and stuff. I’ll try also with new beta (have not installed yet) just in case.
> just put stuff in vboxes and loop over that; at the tex end with calls to lua
Not sure I follow what you mean, sorry about this. I am quite a newbie in ConTeXt and in TeX more generally.
Thanks
Joseph
From: Hans Hagen
Sent: Wednesday, November 18, 2015 10:22 PM
To: ntg-context@ntg.nl
On 11/18/2015 9:49 PM, josephcanedo@gmail.com wrote:
> Hi Hans
>
> First of all, thanks a lot for replying.
>
> I tried your suggestion and it does not seem to work at least for fancy
> features in EB Garamond (historical liguratures and other features).
> I also tried to pass the hbox to tex.linebreak() and got assertion
> failure in luatex.
are you sure that you defined that font and that it's the current font?
> Is there any code snippet available to show the full process in lua code
> (I mean up to shipping the result nodes to the page) ?
no ... thousands of lines spread over many files
> To give some background, I’d like to compute a parshape for some
> paragraphs for which I’d like some special shape. I thought that one
> idea was to build up the lua nodes from text (which has some occasional
> words with smaller or different font style), compute the width of text
> to figure out a first guess for parshape and then iterate on linebreak
> with different parshape settings to refine the first guess.
just put stuff in vboxes and loop over that; at the tex end with calls
to lua
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
___________________________________________________________________________________
[-- Attachment #1.2: Type: text/html, Size: 6414 bytes --]
[-- Attachment #2: hpack_mwe.tex --]
[-- Type: application/octet-stream, Size: 713 bytes --]
\definefontfeature[base][
mode=node, ccmp=yes, calt=yes,
liga=yes, dlig=yes, hlig=yes,
kern=yes, mark=yes, mkmk=yes,
onum=yes, pnum=yes, salt=yes,
script=latn,
dlig=yes, cv91=yes]
\definefontfeature[xvicentury][
ss02=yes, cv01=yes, cv03=yes]
\definefontfamily[mainfont][serif][EBGaramond][features={base, xvicentury}]
\setupbodyfont[mainfont, 9pt]
\startluacode
local function typeset(text)
local head = nodes.typesetters.hpack(text)
node.write(head)
end
userdata = userdata or {}
userdata.typeset = typeset
\stopluacode
\define[1]\TTS{\ctxlua{userdata.typeset([[#1]])}}
\showfontkerns
\starttext
faict insist session univers.
\TTS{faict insist session univers.
}
\stoptext
[-- Attachment #3: hpack_mwe.pdf --]
[-- Type: application/pdf, Size: 8981 bytes --]
[-- Attachment #4: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-19 16:16 ` josephcanedo
@ 2015-11-19 19:11 ` Hans Hagen
2015-11-19 19:26 ` josephcanedo
0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2015-11-19 19:11 UTC (permalink / raw)
To: ntg-context
On 11/19/2015 5:16 PM, josephcanedo@gmail.com wrote:
> Attached simple MWE. The second line has no ligatures/ no glyph
> substitution/ kern
use this ...
\startluacode
userdata = userdata or { }
if not nodes.typesetters.tohbox then
function nodes.typesetters.tohbox(...)
local list = nodes.typesetters.tonodes(...)
local head = nodes.processors.hpack_filter(list)
local hbox = node.hpack(head)
return hbox
end
end
function userdata.typeset(text)
node.write((nodes.typesetters.tohbox(text)))
end
\stopluacode
i'll add tohbox to the core
-----------------------------------------------------------------
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-19 19:11 ` Hans Hagen
@ 2015-11-19 19:26 ` josephcanedo
2015-11-19 20:36 ` Hans Hagen
0 siblings, 1 reply; 11+ messages in thread
From: josephcanedo @ 2015-11-19 19:26 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 2133 bytes --]
I’ll try this in a minute. Thanks a million.
Another bit of complexity, if I have some words in different font (only a few of them), should I call tohbox for these separately and “chain” the different hboxes together ? For example the idea is to “emulate” for instance:
The second line has a word typeset in {\tfx smaller } size.
Thanks a lot again for your help,
Best regards,
Joseph
From: Hans Hagen
Sent: Thursday, November 19, 2015 8:11 PM
To: ntg-context@ntg.nl
On 11/19/2015 5:16 PM, josephcanedo@gmail.com wrote:
> Attached simple MWE. The second line has no ligatures/ no glyph
> substitution/ kern
use this ...
\startluacode
userdata = userdata or { }
if not nodes.typesetters.tohbox then
function nodes.typesetters.tohbox(...)
local list = nodes.typesetters.tonodes(...)
local head = nodes.processors.hpack_filter(list)
local hbox = node.hpack(head)
return hbox
end
end
function userdata.typeset(text)
node.write((nodes.typesetters.tohbox(text)))
end
\stopluacode
i'll add tohbox to the core
-----------------------------------------------------------------
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
___________________________________________________________________________________
[-- Attachment #1.2: Type: text/html, Size: 5187 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: "Trial typesetting" in ConTeXt / lua ?
2015-11-19 19:26 ` josephcanedo
@ 2015-11-19 20:36 ` Hans Hagen
0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2015-11-19 20:36 UTC (permalink / raw)
To: ntg-context
On 11/19/2015 8:26 PM, josephcanedo@gmail.com wrote:
> I’ll try this in a minute. Thanks a million.
> Another bit of complexity, if I have some words in different font (only
> a few of them), should I call tohbox for these separately and “chain”
> the different hboxes together ? For example the idea is to “emulate” for
> instance:
>
> The second line has a word typeset in {\tfx smaller } size.
the string is not interpreted
why not put the content it in a box ?
\setbox0\hbox{....}
you can then use the list at he lua end with tex.box[0]
> Thanks a lot again for your help,
>
> Best regards,
>
> Joseph
>
> *From:* Hans Hagen <mailto:pragma@wxs.nl>
> *Sent:* Thursday, November 19, 2015 8:11 PM
> *To:* ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>
>
> On 11/19/2015 5:16 PM, josephcanedo@gmail.com wrote:
> > Attached simple MWE. The second line has no ligatures/ no glyph
> > substitution/ kern
>
> use this ...
>
> \startluacode
> userdata = userdata or { }
>
> if not nodes.typesetters.tohbox then
> function nodes.typesetters.tohbox(...)
> local list = nodes.typesetters.tonodes(...)
> local head = nodes.processors.hpack_filter(list)
> local hbox = node.hpack(head)
> return hbox
> end
> end
>
> function userdata.typeset(text)
> node.write((nodes.typesetters.tohbox(text)))
> end
>
> \stopluacode
>
> i'll add tohbox to the core
>
>
> -----------------------------------------------------------------
> 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
> ___________________________________________________________________________________
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
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] 11+ messages in thread
end of thread, other threads:[~2015-11-19 20:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-14 10:16 "Trial typesetting" in ConTeXt / lua ? josephcanedo
2015-11-17 8:15 ` josephcanedo
2015-11-17 22:09 ` josephcanedo
2015-11-18 1:46 ` Hans Hagen
2015-11-18 20:49 ` josephcanedo
2015-11-18 21:22 ` Hans Hagen
2015-11-18 21:36 ` josephcanedo
2015-11-19 16:16 ` josephcanedo
2015-11-19 19:11 ` Hans Hagen
2015-11-19 19:26 ` josephcanedo
2015-11-19 20:36 ` Hans Hagen
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).