ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug: \adjustspacing=1 does not disable expansion
@ 2019-12-04 21:04 Henri Menke
  2019-12-05  0:34 ` Henri Menke
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke @ 2019-12-04 21:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear devs,

The \adjustspacing register is described in the LuaTeX manual as
follows:

     When \adjustspacing has value 2, hz optimization will be applied to glyphs and kerns. When
     the value is 3, only glyphs will be treated. A value smaller than 2 disables this feature.

However, setting \adjustspacing=1 will only disable shrink but not
stretch.  Please find a minimal example example, where I have used
exaggerated values for shrink and stretch to emphasize the issue.  It
can be reproduced with both mtxrun --script plain and luatex with
luaotfload.sty.

I have already checked linebreak.c but add_to_widths looks innocuous and
properly checks the adjust_spacing parameter.

Cheers, Henri

---

%\input luaotfload.sty
\directlua{
   fonts.expansions.setups.default.stretch = 2000
   fonts.expansions.setups.default.shrink = 2000
}
\adjustspacing=1
\font\1="file:lmroman10-regular.otf:expansion=default"
\hsize=5em
\1 \input lorem
\bye
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Bug: \adjustspacing=1 does not disable expansion
  2019-12-04 21:04 Bug: \adjustspacing=1 does not disable expansion Henri Menke
@ 2019-12-05  0:34 ` Henri Menke
  2019-12-05  0:39   ` Henri Menke
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke @ 2019-12-05  0:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Possible patch (can be directly used with `git apply')

diff --git a/source/texk/web2c/luatexdir/tex/postlinebreak.c b/source/texk/web2c/luatexdir/tex/postlinebreak.c
index cbc77e556..9cd76b5fa 100644
--- a/source/texk/web2c/luatexdir/tex/postlinebreak.c
+++ b/source/texk/web2c/luatexdir/tex/postlinebreak.c
@@ -440,7 +440,7 @@ void ext_post_line_break(int paragraph_dir,
          }
          adjust_tail = adjust_head;
          pre_adjust_tail = pre_adjust_head;
-        if (adjust_spacing > 0) {
+        if (adjust_spacing > 1) {
              just_box = hpack(q, cur_width, cal_expand_ratio, paragraph_dir);
          } else {
              just_box = hpack(q, cur_width, exactly, paragraph_dir);

On 12/5/19 10:04 AM, Henri Menke wrote:
> Dear devs,
> 
> The \adjustspacing register is described in the LuaTeX manual as
> follows:
> 
>       When \adjustspacing has value 2, hz optimization will be applied to glyphs and kerns. When
>       the value is 3, only glyphs will be treated. A value smaller than 2 disables this feature.
> 
> However, setting \adjustspacing=1 will only disable shrink but not
> stretch.  Please find a minimal example example, where I have used
> exaggerated values for shrink and stretch to emphasize the issue.  It
> can be reproduced with both mtxrun --script plain and luatex with
> luaotfload.sty.
> 
> I have already checked linebreak.c but add_to_widths looks innocuous and
> properly checks the adjust_spacing parameter.
> 
> Cheers, Henri
> 
> ---
> 
> %\input luaotfload.sty
> \directlua{
>     fonts.expansions.setups.default.stretch = 2000
>     fonts.expansions.setups.default.shrink = 2000
> }
> \adjustspacing=1
> \font\1="file:lmroman10-regular.otf:expansion=default"
> \hsize=5em
> \1 \input lorem
> \bye
> 
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Bug: \adjustspacing=1 does not disable expansion
  2019-12-05  0:34 ` Henri Menke
@ 2019-12-05  0:39   ` Henri Menke
  2019-12-05  8:33     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke @ 2019-12-05  0:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

It actually seems as if the documentation of LuaTeX is wrong here,
because the behaviour of `\adjustspacing=1' is compatible with
`\pdfadjustspacing=1` in pdfTeX.  From the pdfTeX manual:

     When \pdfadjustspacing is set to 1, font expansion is applied after
     TeX’s normal paragraph breaking routines have broken the paragraph
     into lines. In this case, line breaks are identical to standard TeX
     behavior.

So maybe just copy this paragraph to the LuaTeX manual.

On 12/5/19 1:34 PM, Henri Menke wrote:
> Possible patch (can be directly used with `git apply')
> 
> diff --git a/source/texk/web2c/luatexdir/tex/postlinebreak.c b/source/texk/web2c/luatexdir/tex/postlinebreak.c
> index cbc77e556..9cd76b5fa 100644
> --- a/source/texk/web2c/luatexdir/tex/postlinebreak.c
> +++ b/source/texk/web2c/luatexdir/tex/postlinebreak.c
> @@ -440,7 +440,7 @@ void ext_post_line_break(int paragraph_dir,
>            }
>            adjust_tail = adjust_head;
>            pre_adjust_tail = pre_adjust_head;
> -        if (adjust_spacing > 0) {
> +        if (adjust_spacing > 1) {
>                just_box = hpack(q, cur_width, cal_expand_ratio, paragraph_dir);
>            } else {
>                just_box = hpack(q, cur_width, exactly, paragraph_dir);
> 
> On 12/5/19 10:04 AM, Henri Menke wrote:
>> Dear devs,
>>
>> The \adjustspacing register is described in the LuaTeX manual as
>> follows:
>>
>>        When \adjustspacing has value 2, hz optimization will be applied to glyphs and kerns. When
>>        the value is 3, only glyphs will be treated. A value smaller than 2 disables this feature.
>>
>> However, setting \adjustspacing=1 will only disable shrink but not
>> stretch.  Please find a minimal example example, where I have used
>> exaggerated values for shrink and stretch to emphasize the issue.  It
>> can be reproduced with both mtxrun --script plain and luatex with
>> luaotfload.sty.
>>
>> I have already checked linebreak.c but add_to_widths looks innocuous and
>> properly checks the adjust_spacing parameter.
>>
>> Cheers, Henri
>>
>> ---
>>
>> %\input luaotfload.sty
>> \directlua{
>>      fonts.expansions.setups.default.stretch = 2000
>>      fonts.expansions.setups.default.shrink = 2000
>> }
>> \adjustspacing=1
>> \font\1="file:lmroman10-regular.otf:expansion=default"
>> \hsize=5em
>> \1 \input lorem
>> \bye
>>
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Bug: \adjustspacing=1 does not disable expansion
  2019-12-05  0:39   ` Henri Menke
@ 2019-12-05  8:33     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2019-12-05  8:33 UTC (permalink / raw)
  To: Henri Menke, mailing list for ConTeXt users

On 12/5/2019 1:39 AM, Henri Menke wrote:
> It actually seems as if the documentation of LuaTeX is wrong here,
> because the behaviour of `\adjustspacing=1' is compatible with
> `\pdfadjustspacing=1` in pdfTeX.  From the pdfTeX manual:
> 
>      When \pdfadjustspacing is set to 1, font expansion is applied after
>      TeX’s normal paragraph breaking routines have broken the paragraph
>      into lines. In this case, line breaks are identical to standard TeX
>      behavior.
> 
> So maybe just copy this paragraph to the LuaTeX manual.
ok.

btw, Level 1 is rather useless and was more a variant to the at that 
time bitmap generated instances (which was the original idea: generate 
new fonts with mfm but that mode was dropped). Context doesn't support 
level 1 at all.

-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

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

end of thread, other threads:[~2019-12-05  8:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 21:04 Bug: \adjustspacing=1 does not disable expansion Henri Menke
2019-12-05  0:34 ` Henri Menke
2019-12-05  0:39   ` Henri Menke
2019-12-05  8:33     ` 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).