summaryrefslogtreecommitdiff
path: root/crates/typst-layout/src/math/shared.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-layout/src/math/shared.rs')
-rw-r--r--crates/typst-layout/src/math/shared.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/typst-layout/src/math/shared.rs b/crates/typst-layout/src/math/shared.rs
index 600c130d..1f88d2dd 100644
--- a/crates/typst-layout/src/math/shared.rs
+++ b/crates/typst-layout/src/math/shared.rs
@@ -1,7 +1,9 @@
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;
use super::{LeftRightAlternator, MathContext, MathFragment, MathRun};
@@ -59,6 +61,16 @@ pub fn style_cramped() -> LazyHash<Style> {
EquationElem::set_cramped(true).wrap()
}
+/// Sets flac OpenType feature.
+pub fn style_flac() -> LazyHash<Style> {
+ TextElem::set_features(FontFeatures(vec![(Tag::from_bytes(b"flac"), 1)])).wrap()
+}
+
+/// Sets dtls OpenType feature.
+pub fn style_dtls() -> LazyHash<Style> {
+ TextElem::set_features(FontFeatures(vec![(Tag::from_bytes(b"dtls"), 1)])).wrap()
+}
+
/// The style for subscripts in the current style.
pub fn style_for_subscript(styles: StyleChain) -> [LazyHash<Style>; 2] {
[style_for_superscript(styles), EquationElem::set_cramped(true).wrap()]
@@ -97,15 +109,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