mirror of
https://github.com/typst/typst
synced 2025-05-31 17:26:24 +08:00
Fix stroking of glyphs in math mode (#6243)
This commit is contained in:
parent
82e869023c
commit
3e7a39e968
@ -11,7 +11,7 @@ use typst_library::layout::{
|
||||
};
|
||||
use typst_library::math::{EquationElem, MathSize};
|
||||
use typst_library::text::{Font, Glyph, Lang, Region, TextElem, TextItem};
|
||||
use typst_library::visualize::Paint;
|
||||
use typst_library::visualize::{FixedStroke, Paint};
|
||||
use typst_syntax::Span;
|
||||
use typst_utils::default_math_class;
|
||||
use unicode_math_class::MathClass;
|
||||
@ -235,6 +235,7 @@ pub struct GlyphFragment {
|
||||
pub lang: Lang,
|
||||
pub region: Option<Region>,
|
||||
pub fill: Paint,
|
||||
pub stroke: Option<FixedStroke>,
|
||||
pub shift: Abs,
|
||||
pub width: Abs,
|
||||
pub ascent: Abs,
|
||||
@ -286,6 +287,7 @@ impl GlyphFragment {
|
||||
lang: TextElem::lang_in(styles),
|
||||
region: TextElem::region_in(styles),
|
||||
fill: TextElem::fill_in(styles).as_decoration(),
|
||||
stroke: TextElem::stroke_in(styles).map(|s| s.unwrap_or_default()),
|
||||
shift: TextElem::baseline_in(styles),
|
||||
font_size: TextElem::size_in(styles),
|
||||
math_size: EquationElem::size_in(styles),
|
||||
@ -368,10 +370,10 @@ impl GlyphFragment {
|
||||
font: self.font.clone(),
|
||||
size: self.font_size,
|
||||
fill: self.fill,
|
||||
stroke: self.stroke,
|
||||
lang: self.lang,
|
||||
region: self.region,
|
||||
text: self.c.into(),
|
||||
stroke: None,
|
||||
glyphs: vec![Glyph {
|
||||
id: self.id.0,
|
||||
x_advance: Em::from_length(self.width, self.font_size),
|
||||
|
BIN
tests/ref/issue-6170-equation-stroke.png
Normal file
BIN
tests/ref/issue-6170-equation-stroke.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -297,3 +297,10 @@ Looks at the @quadratic formula.
|
||||
#set page(width: 150pt)
|
||||
#set text(lang: "he")
|
||||
תהא סדרה $a_n$: $[a_n: 1, 1/2, 1/3, dots]$
|
||||
|
||||
--- issue-6170-equation-stroke ---
|
||||
// In this bug stroke settings did not apply to math content.
|
||||
// We expect all of these to have a green stroke.
|
||||
#set text(stroke: green + 0.5pt)
|
||||
|
||||
A $B^2$ $ grave(C)' $
|
||||
|
Loading…
x
Reference in New Issue
Block a user