Skip to content

Commit

Permalink
Math layout: Don’t add frames for MetaElems
Browse files Browse the repository at this point in the history
The tests still pass, but this is probably not the correct solution.
  • Loading branch information
bluebear94 committed May 7, 2024
1 parent cf393f9 commit d4a16da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/typst/src/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use crate::foundations::StyledElem;
use crate::foundations::{
category, Category, Content, Module, Resolve, Scope, StyleChain,
};
use crate::introspection::MetaElem;
use crate::layout::{BoxElem, HElem, Spacing};
use crate::realize::{process, BehavedBuilder};
use crate::text::{LinebreakElem, SpaceElem, TextElem};
Expand Down Expand Up @@ -300,6 +301,10 @@ impl LayoutMath for Content {
return elem.layout_math(ctx, styles);
}

if self.is::<MetaElem>() {
return Ok(());
}

let mut frame = ctx.layout_content(self, styles)?;
if !frame.has_baseline() {
let axis = scaled!(ctx, styles, axis_height);
Expand Down
Binary file added tests/ref/math-class-3727-contextual.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/suite/math/class.typ
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ $class("large", ->)_a$

$limits(class("normal", ->))_a$
$ scripts(class("relation", x))_a $

--- math-class-3727-contextual ---

#let test = context math.class("relation", "--")
$ a test b $

0 comments on commit d4a16da

Please sign in to comment.