Skip to content

Commit 2c79ef8

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

File tree

3 files changed

+88
-37
lines changed

3 files changed

+88
-37
lines changed

texk/web2c/luatexdir/ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2025-03-15 Luigi Scarso <[email protected]>
2+
* : italicsmode fix for eight bit fonts (H.Hagen)
3+
14
2025-03-13 Luigi Scarso <[email protected]>
25
* extra italicsmode (large operator italic spacing) (H.Hagen)
36

+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 7671
3+
#define luatex_svn_revision 7672
44
#endif

texk/web2c/luatexdir/tex/mlist.c

+84-36
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,27 @@ LuaTeX; if not, see <http://www.gnu.org/licenses/>.
6161
*/
6262

6363
/*tex
64-
These two are used to determine if we need to pick up parameters from the
64+
These macros are used to determine if we need to pick up parameters from the
6565
opentype table or the traditional parameter array. We noticed that some macro
6666
packages set both tables so we cannot use that for determining if we have a new
67-
or old font.
67+
or old font. It's a bit guesswork especially when it comes to italics.
6868
*/
6969

70-
#define is_new_mathfont(A) ((font_math_params(A) > 0))
71-
#define is_old_mathfont(A,B) ((font_math_params(A) == 0) && (font_params(A) >= (B)))
72-
73-
/*tex
74-
This is a bit of a guess.
75-
*/
70+
# define trace_italics 0
7671

77-
#define assume_new_math(A) ((font_math_params(A) > 0) && (font_oldmath(A) == 0))
72+
// is_new_mathfont(A) ((font_math_params(A) > 0) && (math_old_par == 0))
73+
// is_old_mathfont(A,B) ((font_math_params(A) == 0) && (font_params(A) >= (B)))
74+
// do_new_math(A) ((font_math_params(A) > 0) && (font_oldmath(A) == 0) && (math_old_par == 0))
7875

79-
/*tex
80-
So we no longer use that test here.
81-
*/
76+
#define is_new_mathfont(A) ((font_math_params(A) > 0))
77+
#define is_old_mathfont(A,B) ((font_math_params(A) == 0) && (font_params(A) >= (B)))
78+
#define assume_new_math(A) ((font_math_params(A) > 0) && (font_oldmath(A) == 0))
8279

8380
// do_new_math_but_not(A) (math_italics_mode_par > 1 ? 0 : do_new_math(A))
84-
// do_new_math_but_not(A) (math_italics_mode_par <= 1)
8581

86-
#define math_italics_between_simple (math_italics_mode_par > 0) // 1 and higher
87-
#define math_italics_independent_italic (math_italics_mode_par <= 1)
88-
#define math_italics_backtrack_operator (math_italics_mode_par > 2) // 3 or more
82+
#define math_italics_between_simple(A) (math_italics_mode_par > 0) // 1 and higher
83+
#define math_italics_independent_italic(A) (math_italics_mode_par > 1 ? 0 : assume_new_math(A))
84+
#define math_italics_backtrack_operator(A) (math_italics_mode_par > 2 ? assume_new_math(A) : 0) // 3 or more
8985

9086
#define protect_glyph(A) subtype(A) = 256
9187

@@ -1165,10 +1161,14 @@ static pointer char_box(internal_font_number f, int c, pointer bb)
11651161
/*tex The new box and its character node. */
11661162
pointer b, p;
11671163
b = new_null_box();
1168-
if (math_italics_independent_italic)
1164+
if (math_italics_independent_italic(f)) {
1165+
# if trace_italics
1166+
printf("[math italics independent italic 1]\n");
1167+
# endif
11691168
width(b) = char_width(f, c);
1170-
else
1169+
} else {
11711170
width(b) = char_width(f, c) + char_italic(f, c);
1171+
}
11721172
height(b) = char_height(f, c);
11731173
depth(b) = char_depth(f, c);
11741174
subtype(b) = math_char_list ;
@@ -2750,7 +2750,10 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
27502750
} else if ((vlink(q) != null) && (type(nucleus(q)) == math_char_node)) {
27512751
/*tex only pure math char nodes */
27522752
internal_font_number f = fam_fnt(math_fam(nucleus(q)),cur_size);
2753-
if (math_italics_independent_italic) {
2753+
if (math_italics_independent_italic(f)) {
2754+
# if trace_italics
2755+
printf("[math italics independent italic 2]\n");
2756+
# endif
27542757
ic = char_italic(f,math_character(nucleus(q)));
27552758
}
27562759
}
@@ -3139,13 +3142,19 @@ static scaled make_op(pointer q, int cur_style)
31393142
small_char(y) = math_character(nucleus(q));
31403143
x = do_delimiter(q, y, text_size, ok_size, false, cur_style, true, NULL, &delta, NULL);
31413144
if (delta != 0) {
3142-
if (math_italics_backtrack_operator) {
3145+
if (math_italics_backtrack_operator(cur_f)) {
31433146
width(x) -= delta;
3144-
} else if (math_italics_independent_italic) {
3147+
# if trace_italics
3148+
printf("[math italics backtrack operator 1]\n");
3149+
# endif
3150+
} else if (math_italics_independent_italic(cur_f)) {
31453151
/*tex
31463152
As we never added italic correction we don't need to compensate. The ic
31473153
is stored in a special field of the node and applied in some occasions.
31483154
*/
3155+
# if trace_italics
3156+
printf("[math italics independent italic 3]\n");
3157+
# endif
31493158
} else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
31503159
/*tex
31513160
Here we (selectively) remove the italic correction that always gets added
@@ -3169,10 +3178,16 @@ static scaled make_op(pointer q, int cur_style)
31693178
delta = char_italic(cur_f, cur_c);
31703179
x = clean_box(nucleus(q), cur_style, cur_style, math_nucleus_list);
31713180
if (delta != 0) {
3172-
if (math_italics_backtrack_operator) {
3181+
if (math_italics_backtrack_operator(cur_f)) {
31733182
width(x) -= delta;
3174-
} else if (math_italics_independent_italic) {
3183+
# if trace_italics
3184+
printf("[math italics backtrack operator 2]\n");
3185+
# endif
3186+
} else if (math_italics_independent_italic(cur_f)) {
31753187
/*tex we never added italic correction */
3188+
# if trace_italics
3189+
printf("[math italics independent italic 4]\n");
3190+
# endif
31763191
} else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
31773192
/*tex remove italic correction */
31783193
width(x) -= delta;
@@ -3185,12 +3200,16 @@ static scaled make_op(pointer q, int cur_style)
31853200
delta = char_italic(cur_f, cur_c);
31863201
x = clean_box(nucleus(q), cur_style, cur_style, math_nucleus_list);
31873202
if (delta != 0) {
3188-
/* if (math_italics_backtrack_operator) {
3189-
} else */
3190-
if (math_italics_backtrack_operator) {
3203+
if (math_italics_backtrack_operator(cur_f)) {
31913204
width(x) -= delta;
3192-
} else if (math_italics_independent_italic) {
3205+
# if trace_italics
3206+
printf("[math italics backtrack operator 3]\n");
3207+
# endif
3208+
} else if (math_italics_independent_italic(cur_f)) {
31933209
/*tex we never added italic correction */
3210+
# if trace_italics
3211+
printf("[math italics independent italic 5]\n");
3212+
# endif
31943213
} else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
31953214
/*tex remove italic correction */
31963215
width(x) -= delta;
@@ -3207,7 +3226,10 @@ static scaled make_op(pointer q, int cur_style)
32073226
}
32083227
/*tex we now handle op_nod_type_no_limits here too */
32093228
if (subtype(q) == op_noad_type_no_limits) {
3210-
if (math_italics_backtrack_operator) {
3229+
if (math_italics_backtrack_operator(cur_f)) {
3230+
# if trace_italics
3231+
printf("[math italics backtrack operator 4]\n");
3232+
# endif
32113233
/*tex
32123234
Not:
32133235
@@ -3294,7 +3316,10 @@ if (math_italics_backtrack_operator) {
32943316
reset_attributes(v, node_attr(q));
32953317
type(v) = vlist_node;
32963318
subtype(v) = math_limits_list;
3297-
if (math_italics_independent_italic) {
3319+
if (math_italics_independent_italic(cur_f)) {
3320+
# if trace_italics
3321+
printf("[math italics independent italic 6]\n");
3322+
# endif
32983323
n = nucleus(q);
32993324
if (n != null) {
33003325
if ((type(n) == sub_mlist_node) || (type(n) == sub_box_node)) {
@@ -3401,7 +3426,10 @@ if (math_italics_backtrack_operator) {
34013426
supscr(q) = null;
34023427
}
34033428
assign_new_hlist(q, v);
3404-
if (math_italics_independent_italic) {
3429+
if (math_italics_independent_italic(cur_f)) {
3430+
# if trace_italics
3431+
printf("[math italics independent italic 7]\n");
3432+
# endif
34053433
delta = 0;
34063434
}
34073435
}
@@ -3450,7 +3478,11 @@ static void make_ord(pointer q)
34503478
fetch(nucleus(q));
34513479
a = cur_c;
34523480
/*tex add italic correction */
3453-
if (math_italics_independent_italic && (char_italic(cur_f,math_character(nucleus(q))) != 0)) {
3481+
if (math_italics_independent_italic(cur_f) && (char_italic(cur_f,math_character(nucleus(q))) != 0)) {
3482+
# if trace_italics
3483+
printf("[math italics independent italic 8]\n");
3484+
# endif
3485+
34543486
p = new_kern(char_italic(cur_f,math_character(nucleus(q))));
34553487
subtype(p) = italic_kern;
34563488
reset_attributes(p, node_attr(q));
@@ -4329,18 +4361,27 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_styl
43294361
fetch(nucleus(q));
43304362
if (char_exists(cur_f, cur_c)) {
43314363
/*tex we could look at neighbours */
4332-
if (math_italics_independent_italic) {
4364+
if (math_italics_independent_italic(cur_f)) {
43334365
/*tex cf spec only the last one */
4366+
# if trace_italics
4367+
printf("[math italics independent italic 9]\n");
4368+
# endif
43344369
*delta = 0 ;
43354370
} else {
43364371
*delta = char_italic(cur_f, cur_c);
43374372
}
43384373
p = new_glyph(cur_f, cur_c);
43394374
protect_glyph(p);
43404375
reset_attributes(p, node_attr(nucleus(q)));
4341-
if (math_italics_backtrack_operator) {
4376+
if (math_italics_backtrack_operator(cur_f)) {
4377+
# if trace_italics
4378+
printf("[math italics backtrack operator 5]\n");
4379+
# endif
43424380
/* do nothing */
4343-
} else if (math_italics_independent_italic) {
4381+
} else if (math_italics_independent_italic(cur_f)) {
4382+
# if trace_italics
4383+
printf("[math italics independent italic 10]\n");
4384+
# endif
43444385
if (get_char_cat_code(cur_c) == 11) {
43454386
/*tex no italic correction in mid-word of text font */
43464387
*delta = 0;
@@ -4358,8 +4399,12 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_styl
43584399
reset_attributes(x, node_attr(nucleus(q)));
43594400
couple_nodes(p,x);
43604401
*delta = 0;
4361-
} else if (math_italics_independent_italic) {
4402+
} else if (math_italics_independent_italic(cur_f)) {
43624403
/*tex Needs checking but looks ok. It must be more selective. */
4404+
# if trace_italics
4405+
printf("[math italics independent italic 11]\n");
4406+
# endif
4407+
43634408
*delta = char_italic(cur_f, cur_c);
43644409
}
43654410
}
@@ -4658,7 +4703,10 @@ void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
46584703
the scripts so if it's optional here it also should be there.
46594704
46604705
*/
4661-
if (nxt && math_italics_between_simple && (delta != 0)) {
4706+
if (nxt && math_italics_between_simple(null) && (delta != 0)) {
4707+
# if trace_italics
4708+
printf("[math italics between simple 1]\n");
4709+
# endif
46624710
if (type(nxt) == simple_noad) {
46634711
switch (subtype(nxt)) {
46644712
case ord_noad_type:

0 commit comments

Comments
 (0)