mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 22:36:12 +02:00
🔧 Parse text leaves all at once
This commit is contained in:
parent
18dea6c3a3
commit
83f72f3e41
8 changed files with 457 additions and 117 deletions
|
@ -699,25 +699,10 @@ impl Shape {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_text_leaf(
|
||||
&mut self,
|
||||
text_str: String,
|
||||
font_family: FontFamily,
|
||||
font_size: f32,
|
||||
) -> Result<(), String> {
|
||||
pub fn add_paragraph(&mut self, paragraph: Paragraph) -> Result<(), String> {
|
||||
match self.shape_type {
|
||||
Type::Text(ref mut text) => {
|
||||
text.add_leaf(text_str, font_family, font_size)?;
|
||||
Ok(())
|
||||
}
|
||||
_ => Err("Shape is not a text".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_text_paragraph(&mut self) -> Result<(), String> {
|
||||
match self.shape_type {
|
||||
Type::Text(ref mut text) => {
|
||||
text.add_paragraph();
|
||||
text.add_paragraph(paragraph);
|
||||
Ok(())
|
||||
}
|
||||
_ => Err("Shape is not a text".to_string()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue