[NTG-context] Count (and limit) glyphs per line?
Hans Hagen
j.hagen at xs4all.nl
Sun Jun 26 19:11:00 CEST 2022
On 6/25/2022 10:25 PM, Benjamin Buchmuller via ntg-context wrote:
> Dear list,
>
> A brief follow-up for (1) itemizations [resolved; but question on ConTeXt hsize defaults] and (2) hyphenation [troubles].
>
> (1) To deal with itemizations and other situation where texts are indented such as:
>
> \setuppapersize[landscape,letter]
> \showframe
> \starttext
> \samplefile{knuth}
> \ctxlua{context(tex.dimen["textwidth"])} % 37213340
> \ctxlua{context(tex.dimen["localhsize"])} % 0
> \startitemize[width=5em]
> \item \samplefile{knuth}
> \ctxlua{context(tex.dimen["textwidth"])} % 37213340
> \ctxlua{context(tex.dimen["localhsize"])} % 33283340
> \stopitemize
> \stoptext
The problem with these thing is that there is more involved than just
counting, like font features, hyphenation, current paragrph properties,
etc. and you don't want interference with other features. You also want
the paragraphs to look somewhat ok. Folks who enforce such demands on
authors never wonder where the tools do do that come from (publishers
and probably most designers are not interested in that anyway: thinking
probably stops at the number '120').
Attached a proof of concept that gives an idea. No upload as first we
need to do some wrapping up of math. Not that we needed something in the
engine other than the linebreak helper to accept direct modes (no need
to go back and forth then and i only want write this crap once). Could
be a module although it's only some 70 lines of code in the end. Maybe
it makes a nice (lmtx) demo for the ctx meeting too.
Here we work per paragraph not per line which looks better on the
average. One could mess with parshapes but why bother.
(The todo in the name refers to the fact that it might do into a th elow
level paragraph manual.)
(No more time now but we can add later; remind me if I forget.)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: todo-paragraphs.pdf
Type: application/pdf
Size: 49150 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20220626/5c270f4f/attachment-0001.pdf>
More information about the ntg-context
mailing list