ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: hz / expansion
Date: Mon, 2 Dec 2019 18:52:33 +0100	[thread overview]
Message-ID: <d63df951-49fe-df96-4a1d-e0c3ee45066a@xs4all.nl> (raw)

Hi,

The latest lmtx has a new feature: expansion control independent of font 
specific settings. When used the font specific step stretch and shrink 
will be overloaded. This permits mixed setups that are normally nor 
possible because these three properties need to be consistent within a 
paragraph. It also permits local deviations from the defaults, for 
instance in more extreme cases.

\startluacode

     local classes = fonts.expansions.classes

     classes.qualityb = {
         vector  = "default",
         factor  = 1,
         stretch = 8,
         shrink  = 4,
         step    = .5,
     }

     classes.qualitya = {
         vector  = "default",
         factor  = 1,
         stretch = 4,
         shrink  = 2,
         step    = .5,
     }

\stopluacode

\showframe

% \enabletrackers[*expansion]

\setupbodyfont[dejavu,8pt]

\defineexpansion
   [myexpansion]
   [step=1,
    stretch=50,
    shrink=20]

\definefontfeature [basea] [default] [expansion=qualitya]
\definefontfeature [baseb] [default] [expansion=qualityb]

\definefont[FontA][Serif*basea]
\definefont[FontB][Serif*baseb]

\setupalign[verytolerant,stretch,hz]

\starttext

\startbuffer
     \dorecurse {30} {%
         {\FontB \red test me #1,} \FontA \dorecurse{#1}{test ##1, }%
     }\par
\stopbuffer

                            {\getbuffer \page}
\setexpansion[myexpansion] {\getbuffer \page}

\stoptext

Maybe it's useful (I hardly use expansion myself). Hopefully there are 
no side effects.

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
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2019-12-02 17:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 17:52 Hans Hagen [this message]
2019-12-05 19:01 ` Pablo Rodriguez
2019-12-07 22:51   ` Pablo Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d63df951-49fe-df96-4a1d-e0c3ee45066a@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).