mirror of
https://github.com/typst/typst
synced 2025-08-24 19:54:14 +08:00
Rename str
parameter in try_new to text
This commit is contained in:
parent
8f5aaf16a2
commit
8d35c6afc1
@ -271,11 +271,11 @@ impl GlyphFragment {
|
|||||||
pub fn try_new(
|
pub fn try_new(
|
||||||
font: &Font,
|
font: &Font,
|
||||||
styles: StyleChain,
|
styles: StyleChain,
|
||||||
str: &str,
|
text: &str,
|
||||||
span: Span,
|
span: Span,
|
||||||
) -> Option<GlyphFragment> {
|
) -> Option<GlyphFragment> {
|
||||||
let mut buffer = UnicodeBuffer::new();
|
let mut buffer = UnicodeBuffer::new();
|
||||||
buffer.push_str(str);
|
buffer.push_str(text);
|
||||||
buffer.set_language(language(styles));
|
buffer.set_language(language(styles));
|
||||||
// TODO: Use `rustybuzz::script::MATH` once
|
// TODO: Use `rustybuzz::script::MATH` once
|
||||||
// https://github.com/harfbuzz/rustybuzz/pull/165 is released.
|
// https://github.com/harfbuzz/rustybuzz/pull/165 is released.
|
||||||
@ -309,7 +309,7 @@ impl GlyphFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cluster = info.cluster as usize;
|
let cluster = info.cluster as usize;
|
||||||
let c = str[cluster..].chars().next().unwrap();
|
let c = text[cluster..].chars().next().unwrap();
|
||||||
let limits = Limits::for_char(c);
|
let limits = Limits::for_char(c);
|
||||||
let class = EquationElem::class_in(styles)
|
let class = EquationElem::class_in(styles)
|
||||||
.or_else(|| default_math_class(c))
|
.or_else(|| default_math_class(c))
|
||||||
@ -322,14 +322,14 @@ impl GlyphFragment {
|
|||||||
stroke: TextElem::stroke_in(styles).map(|s| s.unwrap_or_default()),
|
stroke: TextElem::stroke_in(styles).map(|s| s.unwrap_or_default()),
|
||||||
lang: TextElem::lang_in(styles),
|
lang: TextElem::lang_in(styles),
|
||||||
region: TextElem::region_in(styles),
|
region: TextElem::region_in(styles),
|
||||||
text: str.into(),
|
text: text.into(),
|
||||||
glyphs: vec![Glyph {
|
glyphs: vec![Glyph {
|
||||||
id: info.glyph_id as u16,
|
id: info.glyph_id as u16,
|
||||||
x_advance: font.to_em(pos.x_advance),
|
x_advance: font.to_em(pos.x_advance),
|
||||||
x_offset: Em::zero(),
|
x_offset: Em::zero(),
|
||||||
y_advance: Em::zero(),
|
y_advance: Em::zero(),
|
||||||
y_offset: Em::zero(),
|
y_offset: Em::zero(),
|
||||||
range: 0..str.len().saturating_as(),
|
range: 0..text.len().saturating_as(),
|
||||||
span: (span, 0),
|
span: (span, 0),
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user