Negative font slant broken with compact fonts
Hi, Using the latest ConTeXt (2025.02.19), negative slants are broken with compact fonts. Example document: \definefontfeature[default][default][Slant=-1] \startTEXpage Hello, world! \stopTEXpage When compiled with "context", I get the error message tex error > tex error on line 1 in file ./context-negative-slant.tex: Scale factor (-1000) should be in the range 0..100000 [...] I'm going to use 0 instead of that illegal code value. but when compiled with "context --nocompactfonts", I get the correct result. Thanks, -- Max
On 3/19/25 10:51, Max Chernoff via ntg-context wrote:
Hi,
Using the latest ConTeXt (2025.02.19), negative slants are broken with compact fonts. Example document:
Hi Max, my current latest is from 2025.02.28 18:16.
\definefontfeature[default][default][Slant=-1]
\startTEXpage Hello, world! \stopTEXpage
When compiled with "context", I get the error message
I get no error an no slanted font.
but when compiled with "context --nocompactfonts", I get the correct result.
I’m afraid I get no slanted fonts with "--nocompactfonts". Weird, I use LuaMetaTeX 2.11.07 20250226 and I have to enable compact fonts in Linux-64 with that version. I also have been experiencing an issue already reported before (https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/thread/GWDVD3CNPJQOH...). Either slanted is specified for \definefontfamily or it doesn’t work for \definefallbackfamily: \enableexperiments[fonts.compact] \definefallbackfamily [mainface][rm][Dejavu Sans] [sl={style:regular, features:slanted},preset=range:greek] \definefontfamily [mainface][rm][Latin Modern Sans] %[sl={style:regular, features:slanted}] \setupbodyfont [mainface] \starttext αβγ9 some word others\\ \sl αβγ9 some word others \stoptext I wonder whether these issues might be somehow related. Just in case it might help, Pablo
Hi Pablo, On Wed, 2025-03-19 at 18:00 +0100, Pablo Rodriguez via ntg-context wrote:
Weird, I use LuaMetaTeX 2.11.07 20250226
Ah, my binaries must have not updated properly since I still had 2.11.06. I deleted the binaries and reran the updater, so I now have 2.11.07. I also deleted the system and user format/font caches just in case there was a problem there.
When compiled with "context", I get the error message
I get no error an no slanted font.
but when compiled with "context --nocompactfonts", I get the correct result.
I’m afraid I get no slanted fonts with "--nocompactfonts".
I tried it again now (after updating), and with compact fonts I still get the same error, and with "--nocompactfonts" I get the reverse-slanted font, as expected.
in Linux-64 with that version.
Hmm, I'm also on Linux x86_64 with the same version, so it's really weird that we get different results.
I also have been experiencing an issue already reported before (https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/thread/GWDVD3CNPJQOH...).
Either slanted is specified for \definefontfamily or it doesn’t work for \definefallbackfamily:
\enableexperiments[fonts.compact] \definefallbackfamily [mainface][rm][Dejavu Sans] [sl={style:regular, features:slanted},preset=range:greek] \definefontfamily [mainface][rm][Latin Modern Sans] %[sl={style:regular, features:slanted}] \setupbodyfont [mainface] \starttext αβγ9 some word others\\ \sl αβγ9 some word others \stoptext
I wonder whether these issues might be somehow related.
I tried compiling that document just now, and with the "sl=" uncommented, I get the correctly-slanted Greek letters, both with and without compact fonts enabled. This is really weird. Maybe try deleting your luametatex binary and rerunning the updater to make sure that your binaries are up-to-date, and try deleting your user/system font/format caches? Thanks, -- Max
On 3/20/25 00:57, Max Chernoff via ntg-context wrote:
On Wed, 2025-03-19 at 18:00 +0100, Pablo Rodriguez via ntg-context wrote:
Weird, I use LuaMetaTeX 2.11.07 20250226
Hi Max, sorry, wrong testing here. I do get your error as long as I don’t put the font feature definition after \starttext. BTW, I needed to add an \stoptext, because my file for test is a huge concatenation of previous tests.
I tried compiling that document just now, and with the "sl=" uncommented, I get the correctly-slanted Greek letters, both with and without compact fonts enabled.
This is really weird. Maybe try deleting your luametatex binary and rerunning the updater to make sure that your binaries are up-to-date, and try deleting your user/system font/format caches?
I have just done it and it works now with some caveats (I think this might have worked before [but I cannot test that now]): 1. \enableexperiments[fonts.compact] shouldn’t be loaded in the source. 2. "context testing.tex" doesn’t get the fake slanted font, but "context --environment=testing.tex whatever.xml" has it. 3. "context --result=whatever.pdf testing.tex" doesn’t get the fake slanted font. 4. "context --compactfonts --environment=testing.tex whatever.xml" contains the fake slanted font (just in case anyone wonders). I don’t know what I am doing wrong (or what I may be missing here). Many thanks for your help, Pablo PS: the final source for this testing reads (just to be clear, since this seems to be too tricky [at least, to me]) \definefallbackfamily [mainface][rm][DejaVu Sans] [sl={style:regular, features:slanted},preset=range:greek] \definefontfamily [mainface][rm][Latin Modern Sans] \setupbodyfont [mainface] \starttext αβγ9 some word others\\ \sl αβγ9 some word others \stoptext
Hi Hans, On Wed, 2025-03-19 at 03:51 -0600, Max Chernoff wrote:
Using the latest ConTeXt (2025.02.19), negative slants are broken with compact fonts. Example document:
\definefontfeature[default][default][Slant=-1]
\startTEXpage Hello, world! \stopTEXpage
When compiled with "context", I get the error message
tex error > tex error on line 1 in file ./context-negative-slant.tex: Scale factor (-1000) should be in the range 0..100000 [...] I'm going to use 0 instead of that illegal code value.
but when compiled with "context --nocompactfonts", I get the correct result.
Negative slants still seem to be broken with the latest (2025.09.25 18:46). Applying the patch at the end of the email seems to fix things, but it's more of a hack than a real solution since a negative "scale" doesn't really make much sense. Thanks, -- Max diff --git a/texmf-context/source/luametatex/source/tex/textypes.h b/texmf-context/source/luametatex/source/tex/textypes.h index 0fe86eb..c0d3488 100644 --- a/texmf-context/source/luametatex/source/tex/textypes.h +++ b/texmf-context/source/luametatex/source/tex/textypes.h @@ -219,7 +219,7 @@ extern halfword tex_badness( # define min_space_factor 0 /*tex watch out: |\spacefactor| cannot be zero but the sf code can!*/ # define max_space_factor 0x7FFF /*tex |077777| */ -# define min_scale_factor 0 +# define min_scale_factor -100000 # define max_scale_factor 100000 /*tex for now */ # define default_space_factor 1000 # define space_factor_threshold 2000 @@ -1116,4 +1116,3 @@ typedef enum tex_character_control_codes { # define has_character_control(a,b) ((a & b) != 0) # endif
On 10/6/2025 10:50 AM, Max Chernoff via ntg-context wrote:
Hi Hans,
On Wed, 2025-03-19 at 03:51 -0600, Max Chernoff wrote:
Using the latest ConTeXt (2025.02.19), negative slants are broken with compact fonts. Example document:
\definefontfeature[default][default][Slant=-1]
\startTEXpage Hello, world! \stopTEXpage
When compiled with "context", I get the error message
tex error > tex error on line 1 in file ./context-negative-slant.tex: Scale factor (-1000) should be in the range 0..100000 [...] I'm going to use 0 instead of that illegal code value.
but when compiled with "context --nocompactfonts", I get the correct result.
Negative slants still seem to be broken with the latest (2025.09.25 18:46). Applying the patch at the end of the email seems to fix things, but it's more of a hack than a real solution since a negative "scale" doesn't really make much sense.
Thanks, -- Max
diff --git a/texmf-context/source/luametatex/source/tex/textypes.h b/texmf-context/source/luametatex/source/tex/textypes.h index 0fe86eb..c0d3488 100644 --- a/texmf-context/source/luametatex/source/tex/textypes.h +++ b/texmf-context/source/luametatex/source/tex/textypes.h @@ -219,7 +219,7 @@ extern halfword tex_badness(
# define min_space_factor 0 /*tex watch out: |\spacefactor| cannot be zero but the sf code can!*/ # define max_space_factor 0x7FFF /*tex |077777| */ -# define min_scale_factor 0 +# define min_scale_factor -100000 # define max_scale_factor 100000 /*tex for now */ # define default_space_factor 1000 # define space_factor_threshold 2000 @@ -1116,4 +1116,3 @@ typedef enum tex_character_control_codes { # define has_character_control(a,b) ((a & b) != 0)
# endif
That is indeed somewhat hackish. Actually \glyphxscale -200 x \glyphslant -100 x are catched as they are internal integers that get clipped later on ... we can either bark or just silently clip to 0 and 100K whichis more consistent .. as you say, negative values make no sense 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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen -
Max Chernoff -
Pablo Rodriguez