diff options
Diffstat (limited to 'source/luametatex/source/tex/texnodes.c')
-rw-r--r-- | source/luametatex/source/tex/texnodes.c | 118 |
1 files changed, 94 insertions, 24 deletions
diff --git a/source/luametatex/source/tex/texnodes.c b/source/luametatex/source/tex/texnodes.c index ab2601a43..1c4a6b896 100644 --- a/source/luametatex/source/tex/texnodes.c +++ b/source/luametatex/source/tex/texnodes.c @@ -2669,9 +2669,9 @@ void tex_show_node_list(halfword p, int threshold, int max) if (valid_direction(box_dir(p))) { tex_print_str(", direction "); switch (box_dir(p)) { - case 0 : tex_print_str("l2r"); break; - case 1 : tex_print_str("r2l"); break; - default : tex_print_str("unset"); break; + case dir_lefttoright: tex_print_str("l2r"); break; + case dir_righttoleft: tex_print_str("r2l"); break; + default : tex_print_str("unset"); break; } } if (box_geometry(p)) { @@ -3372,14 +3372,38 @@ scaled tex_glyph_depth(halfword p) /* not used */ return d < 0 ? 0 : d; } +// scaledwhd tex_glyph_dimensions(halfword p) +// { +// scaledwhd whd = { 0, 0, 0, 0 }; +// scaled x = glyph_x_offset(p); +// scaled y = glyph_y_offset(p); +// whd.ht = tex_char_height_from_glyph(p) + glyph_raise(p); +// whd.dp = tex_char_depth_from_glyph(p) - glyph_raise(p); +// whd.wd = tex_char_width_from_glyph(p) - (glyph_left(p) + glyph_right(p)); +// if (x && tex_has_glyph_option(p, glyph_option_apply_x_offset)) { +// whd.wd += x; +// } +// if (y && tex_has_glyph_option(p, glyph_option_apply_y_offset)) { +// whd.ht += y; +// whd.dp -= y; +// } +// if (whd.ht < 0) { +// whd.ht = 0; +// } +// if (whd.dp < 0) { +// whd.dp = 0; +// } +// return whd; +// } + scaledwhd tex_glyph_dimensions(halfword p) { - scaledwhd whd = { 0, 0, 0, 0 }; + scaledwhd whd = tex_char_whd_from_glyph(p); scaled x = glyph_x_offset(p); scaled y = glyph_y_offset(p); - whd.ht = tex_char_height_from_glyph(p) + glyph_raise(p); - whd.dp = tex_char_depth_from_glyph(p) - glyph_raise(p); - whd.wd = tex_char_width_from_glyph(p) - (glyph_left(p) + glyph_right(p)); + whd.ht += glyph_raise(p); + whd.dp -= glyph_raise(p); + whd.wd += (glyph_left(p) + glyph_right(p)); if (x && tex_has_glyph_option(p, glyph_option_apply_x_offset)) { whd.wd += x; } @@ -3396,14 +3420,41 @@ scaledwhd tex_glyph_dimensions(halfword p) return whd; } +// scaledwhd tex_glyph_dimensions_ex(halfword p) +// { +// scaledwhd whd = { 0, 0, 0, 0 }; +// scaled x = glyph_x_offset(p); +// scaled y = glyph_y_offset(p); +// whd.ht = tex_char_height_from_glyph(p) + glyph_raise(p); +// whd.dp = tex_char_depth_from_glyph(p) - glyph_raise(p); +// whd.wd = tex_char_width_from_glyph(p) - (glyph_left(p) + glyph_right(p)); +// if (x && tex_has_glyph_option(p, glyph_option_apply_x_offset)) { +// whd.wd += x; +// } +// if (y && tex_has_glyph_option(p, glyph_option_apply_y_offset)) { +// whd.ht += y; +// whd.dp -= y; +// } +// if (whd.ht < 0) { +// whd.ht = 0; +// } +// if (whd.dp < 0) { +// whd.dp = 0; +// } +// if (whd.wd && glyph_expansion(p)) { +// whd.wd = tex_ext_xn_over_d(whd.wd, 1000000 + glyph_expansion(p), 1000000); +// } +// return whd; +// } + scaledwhd tex_glyph_dimensions_ex(halfword p) { - scaledwhd whd = { 0, 0, 0, 0 }; + scaledwhd whd = tex_char_whd_from_glyph(p); scaled x = glyph_x_offset(p); scaled y = glyph_y_offset(p); - whd.ht = tex_char_height_from_glyph(p) + glyph_raise(p); - whd.dp = tex_char_depth_from_glyph(p) - glyph_raise(p); - whd.wd = tex_char_width_from_glyph(p) - (glyph_left(p) + glyph_right(p)); + whd.ht += glyph_raise(p); + whd.dp -= glyph_raise(p); + whd.wd -= (glyph_left(p) + glyph_right(p)); if (x && tex_has_glyph_option(p, glyph_option_apply_x_offset)) { whd.wd += x; } @@ -3423,23 +3474,43 @@ scaledwhd tex_glyph_dimensions_ex(halfword p) return whd; } + scaled tex_glyph_total(halfword p) { - scaled ht = tex_char_height_from_glyph(p); - scaled dp = tex_char_depth_from_glyph(p); - if (ht < 0) { - ht = 0; - } - if (dp < 0) { - dp = 0; - } - return ht + dp; + // scaled ht = tex_char_height_from_glyph(p); + // scaled dp = tex_char_depth_from_glyph(p); + // if (ht < 0) { + // ht = 0; + // } + // if (dp < 0) { + // dp = 0; + // } + // return ht + dp; + return tex_char_total_from_glyph(p); } +// int tex_glyph_has_dimensions(halfword p) +// { +// scaled offset = glyph_x_offset(p); +// scaled amount = tex_char_width_from_glyph(p); +// if (offset && tex_has_glyph_option(p, glyph_option_apply_x_offset)) { +// amount += offset; +// } +// amount -= (glyph_left(p) + glyph_right(p)); +// if (amount) { +// return 1; +// } else { +// amount = tex_char_total_from_glyph(p); +// /* here offset and raise just moves */ +// return amount != 0; +// } +// } + int tex_glyph_has_dimensions(halfword p) { + scaledwhd whd = tex_char_whd_from_glyph(p); scaled offset = glyph_x_offset(p); - scaled amount = tex_char_width_from_glyph(p); + scaled amount = whd.wd; if (offset && tex_has_glyph_option(p, glyph_option_apply_x_offset)) { amount += offset; } @@ -3447,9 +3518,8 @@ int tex_glyph_has_dimensions(halfword p) if (amount) { return 1; } else { - amount = tex_char_total_from_glyph(p); - /* here offset adn raise just moves */ - return amount != 0; + /* here offset and raise just moves */ + return whd.ht > 0 || whd.dp > 0; } } |