Skip to content

Commit 185be24

Browse files
committed
copy r74603 (luatex upright integral fix) from trunk to branch2025
git-svn-id: svn://tug.org/texlive/branches/branch2025/Build/source@74609 c570f23f-e606-0410-a88d-b1316a301751
1 parent e29dd1f commit 185be24

File tree

10 files changed

+164
-140
lines changed

10 files changed

+164
-140
lines changed

texk/web2c/doc/luatex/luatex-math.tex

+76-44
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% language=uk engine=luatex runpath=texruns:manuals/luatex
1+
% language=us engine=luatex runpath=texruns:manuals/luatex
22

33
\environment luatex-style
44

@@ -835,31 +835,58 @@ \subsection{Skips around display math}
835835

836836
\topicindex {math+italics}
837837

838-
The \lpr {mathitalicsmode} parameter can be set to~1 to force italic correction
839-
before noads that represent some more complex structure (read: everything that is
840-
not an ord, bin, rel, open, close, punct or inner). A value of~2 will enforce the
841-
old school font code path for all italics. We show a Cambria example.
842-
843-
\starttexdefinition Whatever #1
844-
\NC \type{\mathitalicsmode = #1}
845-
\NC \mathitalicsmode#1\ruledhbox{$\left|T^1\right|$}
846-
\NC \mathitalicsmode#1\ruledhbox{$\left|T\right|$}
847-
\NC \mathitalicsmode#1\ruledhbox{$T+1$}
848-
\NC \mathitalicsmode#1\ruledhbox{$T{1\over2}$}
849-
\NC \mathitalicsmode#1\ruledhbox{$T\sqrt{1}$}
850-
\NC \NR
851-
\stoptexdefinition
852-
853-
\start
854-
\switchtobodyfont[cambria]
855-
\starttabulate[|c|c|c|c|c|c|]
856-
\Whatever{0}%
857-
\Whatever{1}%
858-
\stoptabulate
859-
\stop
860-
861-
This kind of parameters relate to the fact that italic correction in \OPENTYPE\
862-
math is bound to fuzzy rules. So, control is the solution.
838+
The \lpr {mathitalicsmode} parameter was introduced to deal with the difference
839+
in applying italic correction in traditional and \OPENTYPE\ math fonts. There are
840+
\OPENTYPE\ fonts out there that have italic correction and assume them to be
841+
applied like traditional \TEX\ fonts. This parameter takes several values:
842+
843+
When set to zero, you get what was decided when the two code paths (traditional
844+
and \OPENTYPE) were introduced.
845+
846+
Values larger than zero will add the italic correction between simple noads (it
847+
checks some classes so you might pay attention to for instance punctuation
848+
classes assigned).
849+
850+
When set to zero or one, italics are independent, so we separate width from
851+
italic, while values larger than one combine both in the width but later
852+
selectively has to get rid of it (depending on code path).
853+
854+
A value larger than two will backtrack italics for large operators, because there
855+
italic correction is used for anchoring scripts (limits and no limits). In fact,
856+
\OPENTYPE\ uses italics either between characters or for this purpose but as
857+
mentioned fonts are sort of messy here.
858+
859+
We tested our version of plain \TEX\ and recommend to use the value of three to
860+
get the best average results. More about this italic correction dilemma in
861+
rendering math can be found in articles (in for instance \TUGBOAT) and various
862+
documents in the \CONTEXT\ distribution, especially those that discuss the
863+
upgraded math engine in \LUAMETATEX.
864+
865+
% The \lpr {mathitalicsmode} parameter can be set to~1 to force italic correction
866+
% before noads that represent some more complex structure (read: everything that is
867+
% not an ord, bin, rel, open, close, punct or inner). A value of~2 will enforce the
868+
% old school font code path for all italics. We show a Cambria example.
869+
%
870+
% \starttexdefinition Whatever #1
871+
% \NC \type{\mathitalicsmode = #1}
872+
% \NC \mathitalicsmode#1\ruledhbox{$\left|T^1\right|$}
873+
% \NC \mathitalicsmode#1\ruledhbox{$\left|T\right|$}
874+
% \NC \mathitalicsmode#1\ruledhbox{$T+1$}
875+
% \NC \mathitalicsmode#1\ruledhbox{$T{1\over2}$}
876+
% \NC \mathitalicsmode#1\ruledhbox{$T\sqrt{1}$}
877+
% \NC \NR
878+
% \stoptexdefinition
879+
%
880+
% \start
881+
% \switchtobodyfont[cambria]
882+
% \starttabulate[|c|c|c|c|c|c|]
883+
% \Whatever{0}%
884+
% \Whatever{1}%
885+
% \stoptabulate
886+
% \stop
887+
%
888+
% This kind of parameters relate to the fact that italic correction in \OPENTYPE\
889+
% math is bound to fuzzy rules. So, control is the solution.
863890

864891
\subsection {Script and kerning}
865892

@@ -1630,26 +1657,31 @@ \subsection{Allowed math commands in non|-|math modes}
16301657
16311658
\subsection {Math options with \lpr {mathoption}}
16321659
1633-
The logic in the math engine is rather complex and there are often no universal
1634-
solutions (read: what works out well for one font, fails for another). Therefore
1635-
some variations in the implementation are driven by parameters (modes). In
1636-
addition there is a new primitive \lpr {mathoption} which will be used for
1637-
testing. Don't rely on any option to be there in a production version as they are
1638-
meant for development.
1639-
1640-
This option was introduced for testing purposes when the math engine got split
1641-
code paths and it forces the engine to treat new fonts as old ones with respect
1642-
to italic correction etc. There are no guarantees given with respect to the final
1643-
result and unexpected side effects are not seen as bugs as they relate to font
1644-
properties. There is currently only one option:
1660+
This command is now obsolete and triggers an error message. It was only meant
1661+
for experiments.
16451662
1646-
\startbuffer
1647-
\mathoption old 1
1648-
\stopbuffer
1663+
% % even more obsolete:
16491664
1650-
The \type {oldmath} boolean flag in the \LUA\ font table is the official way to
1651-
force old treatment as it's bound to fonts. Like with all options we may
1652-
temporarily introduce with this command this feature is not meant for production.
1665+
% The logic in the math engine is rather complex and there are often no universal
1666+
% solutions (read: what works out well for one font, fails for another). Therefore
1667+
% some variations in the implementation are driven by parameters (modes). In
1668+
% addition there is a new primitive \lpr {mathoption} which will be used for
1669+
% testing. Don't rely on any option to be there in a production version as they are
1670+
% meant for development.
1671+
%
1672+
% This option was introduced for testing purposes when the math engine got split
1673+
% code paths and it forces the engine to treat new fonts as old ones with respect
1674+
% to italic correction etc. There are no guarantees given with respect to the final
1675+
% result and unexpected side effects are not seen as bugs as they relate to font
1676+
% properties. There is currently only one option:
1677+
%
1678+
% \startbuffer
1679+
% \mathoption old 1
1680+
% \stopbuffer
1681+
%
1682+
% The \type {oldmath} boolean flag in the \LUA\ font table is the official way to
1683+
% force old treatment as it's bound to fonts. Like with all options we may
1684+
% temporarily introduce with this command this feature is not meant for production.
16531685
16541686
% % obsolete:
16551687
%

texk/web2c/doc/luatex/luatex.pdf

-1.53 KB
Binary file not shown.

texk/web2c/luatexdir/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2025-03-13 Luigi Scarso <[email protected]>
2+
* extra italicsmode (large operator italic spacing) (H.Hagen)
3+
4+
15
2025-02-28 Akira Kakuto <[email protected]>
26
* luatex.c: Remove problematic lines for windows
37

texk/web2c/luatexdir/luatex.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
stick to "0" upto "9" so users can expect a number represented as string.
3333
*/
3434

35-
int luatex_version = 121;
35+
int luatex_version = 122;
3636
int luatex_revision = '0';
37-
const char *luatex_version_string = "1.21.0";
37+
const char *luatex_version_string = "1.22.0";
3838
const char *engine_name = my_name;
3939

4040
#include <kpathsea/c-ctype.h>
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifndef luatex_svn_revision_h
22
#define luatex_svn_revision_h
3-
#define luatex_svn_revision 7667
3+
#define luatex_svn_revision 7671
44
#endif

texk/web2c/luatexdir/tex/commands.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ void initialize_commands(void)
746746
primitive_luatex("pdfextension", extension_cmd, pdf_extension_code, 0);
747747
primitive_luatex("pdffeedback", feedback_cmd, pdf_feedback_code, 0);
748748
primitive_luatex("pdfvariable", variable_cmd, pdf_variable_code, 0);
749-
primitive_luatex("mathoption", option_cmd, math_option_code, 0);
749+
primitive_luatex("mathoption", option_cmd, 0, 0);
750750

751751
primitive_luatex("luacopyinputnodes", assign_int_cmd, int_base + copy_lua_input_nodes_code, int_base);
752752

texk/web2c/luatexdir/tex/dumpdata.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
3232
3333
*/
3434

35-
#define FORMAT_ID (907+59)
35+
#define FORMAT_ID (907+60)
3636
#if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
3737
#error Wrong value for FORMAT_ID.
3838
#endif

texk/web2c/luatexdir/tex/equivalents.h

+1-27
Original file line numberDiff line numberDiff line change
@@ -315,25 +315,14 @@ the |number_regs| \.{\\dimen} registers.
315315
# define show_stream_code 122
316316
# define math_eq_dir_mode_code 123
317317
# define var_fam_code 124
318-
319318
# define ignore_primitive_error_code 125 /*ignore some primitive/engine errors*/
320-
321319
# define math_empty_display_mode_code 126
322320

323-
# define math_option_code 127
324-
325-
326-
# define mathoption_int_base_code (math_option_code+1) /* one reserve */
327-
# define mathoption_int_last_code (mathoption_int_base_code+8)
328-
329-
# define backend_int_base_code (mathoption_int_last_code+1)
321+
# define backend_int_base_code (math_empty_display_mode_code+1)
330322
# define backend_int_last_code (backend_int_base_code+32) /* we need some 25 but take some slack */
331323

332324
# define tex_int_pars (backend_int_last_code+1) /* total number of integer parameters */
333325

334-
# define mathoption_int_base (int_base+mathoption_int_base_code)
335-
# define mathoption_int_last (int_base+mathoption_int_last_code)
336-
337326
# define backend_int_base (int_base+backend_int_base_code)
338327
# define backend_int_last (int_base+backend_int_last_code)
339328

@@ -471,15 +460,6 @@ extern void print_save_stack(void);
471460
# define loc_par(A) equiv(local_base+(A))
472461
# define glue_par(A) equiv(glue_base+(A))
473462

474-
typedef enum {
475-
c_mathoption_old_code = 0, /* this one is stable */
476-
/*
477-
c_mathoption_umathcode_meaning_code,
478-
*/
479-
} math_option_codes ;
480-
481-
# define mathoption_int_par(A) eqtb[mathoption_int_base+(A)].cint
482-
483463
/* if nonzero, this magnification should be used henceforth */
484464

485465
extern int mag_set;
@@ -783,12 +763,6 @@ extern halfword last_cs_name;
783763
#define error_context_lines_par int_par(error_context_lines_code)
784764
#define copy_lua_input_nodes_par int_par(copy_lua_input_nodes_code)
785765

786-
#define math_old_par mathoption_int_par(c_mathoption_old_code)
787-
788-
/*
789-
#define math_umathcode_meaning_par mathoption_int_par(c_mathoption_umathcode_meaning_code)
790-
*/
791-
792766
#define math_pre_display_gap_factor_par int_par(math_pre_display_gap_factor_code)
793767

794768
#define time_par int_par(time_code)

texk/web2c/luatexdir/tex/maincontrol.c

+3-22
Original file line numberDiff line numberDiff line change
@@ -706,32 +706,13 @@ static void run_normal (void) {
706706
/*tex
707707
708708
This is experimental and not used for production, only for testing and writing
709-
macros (some options stay).
709+
macros (some options stay). It's now obsolete. We keep the cmd_code because it
710+
looks like hard coded numbers are used in macro packages.
710711
711712
*/
712713

713-
#define mathoption_set_int(A) \
714-
scan_int(); \
715-
word_define(mathoption_int_base+A, cur_val);
716-
717714
static void run_option(void) {
718-
int a = 0 ;
719-
switch (cur_chr) {
720-
case math_option_code:
721-
if (scan_keyword("old")) {
722-
mathoption_set_int(c_mathoption_old_code);
723-
/*
724-
} else if (scan_keyword("umathcodemeaning")) {
725-
mathoption_set_int(c_mathoption_umathcode_meaning_code);
726-
*/
727-
} else {
728-
normal_warning("mathoption","unknown key");
729-
}
730-
break;
731-
default:
732-
/* harmless */
733-
break;
734-
}
715+
normal_error("mathoption", "obsolete command");
735716
}
736717

737718
static void lua_function_call(void) {

0 commit comments

Comments
 (0)