mirror of
https://github.com/typst/typst
synced 2025-08-24 11:44:12 +08:00
Add doc comments to methods
This commit is contained in:
parent
a0f17e4b17
commit
63d53761fa
@ -258,10 +258,14 @@ pub struct GlyphFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl GlyphFragment {
|
impl GlyphFragment {
|
||||||
|
/// Calls `try_new` with the given character, assuming the font has a glyph
|
||||||
|
/// for it.
|
||||||
pub fn new(font: &Font, styles: StyleChain, c: char, span: Span) -> Self {
|
pub fn new(font: &Font, styles: StyleChain, c: char, span: Span) -> Self {
|
||||||
Self::try_new(font, styles, c.encode_utf8(&mut [0; 4]), span).unwrap()
|
Self::try_new(font, styles, c.encode_utf8(&mut [0; 4]), span).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Try to create a new glyph out of the given string. Will return None if
|
||||||
|
/// the result from shaping the string is not a single glyph or is a tofu.
|
||||||
pub fn try_new(
|
pub fn try_new(
|
||||||
font: &Font,
|
font: &Font,
|
||||||
styles: StyleChain,
|
styles: StyleChain,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user