Remove delimiter_alignment

This commit is contained in:
mkorje 2025-06-10 14:46:19 +10:00
parent 63d53761fa
commit f067830e74
No known key found for this signature in database
3 changed files with 5 additions and 15 deletions

View File

@ -9,8 +9,8 @@ use typst_library::visualize::{FillRule, FixedStroke, Geometry, LineCap, Shape};
use typst_syntax::Span;
use super::{
alignments, delimiter_alignment, style_for_denominator, AlignmentResult,
FrameFragment, GlyphFragment, LeftRightAlternator, MathContext, DELIM_SHORT_FALL,
alignments, style_for_denominator, AlignmentResult, FrameFragment, GlyphFragment,
LeftRightAlternator, MathContext, DELIM_SHORT_FALL,
};
const VERTICAL_PADDING: Ratio = Ratio::new(0.1);
@ -315,7 +315,7 @@ fn layout_delimiters(
if let Some(left_c) = left {
let mut left = GlyphFragment::new(ctx.font, styles, left_c, span);
left.stretch_vertical(ctx, target - short_fall);
left.align_on_axis(delimiter_alignment(left_c));
left.center_on_axis();
ctx.push(left);
}
@ -324,7 +324,7 @@ fn layout_delimiters(
if let Some(right_c) = right {
let mut right = GlyphFragment::new(ctx.font, styles, right_c, span);
right.stretch_vertical(ctx, target - short_fall);
right.align_on_axis(delimiter_alignment(right_c));
right.center_on_axis();
ctx.push(right);
}

View File

@ -1,7 +1,7 @@
use ttf_parser::math::MathValue;
use ttf_parser::Tag;
use typst_library::foundations::{Style, StyleChain};
use typst_library::layout::{Abs, Em, FixedAlignment, Frame, Point, Size, VAlignment};
use typst_library::layout::{Abs, Em, FixedAlignment, Frame, Point, Size};
use typst_library::math::{EquationElem, MathSize};
use typst_library::text::{FontFeatures, TextElem};
use typst_utils::LazyHash;
@ -107,15 +107,6 @@ pub fn style_for_script_scale(ctx: &MathContext) -> LazyHash<Style> {
.wrap()
}
/// How a delimieter should be aligned when scaling.
pub fn delimiter_alignment(delimiter: char) -> VAlignment {
match delimiter {
'⌜' | '⌝' => VAlignment::Top,
'⌞' | '⌟' => VAlignment::Bottom,
_ => VAlignment::Horizon,
}
}
/// Stack rows on top of each other.
///
/// Add a `gap` between each row and uses the baseline of the `baseline`-th

View File

@ -65,7 +65,6 @@ pub fn stretch_fragment(
glyph.stretch(ctx, stretch.relative_to(relative_to_size) - short_fall, stretch_axis);
if stretch_axis == Axis::Y {
// TODO: this should use delimiter_alignment
glyph.center_on_axis();
}
}