mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
♻️ Refactor and rename ParagraphBuilder instantiating from TextContent
This commit is contained in:
@@ -24,6 +24,7 @@ pub use surfaces::{SurfaceId, Surfaces};
|
||||
use crate::performance;
|
||||
use crate::shapes::{Blur, BlurType, Corners, Fill, Shape, StructureEntry, Type};
|
||||
use crate::state::ShapesPool;
|
||||
use crate::textlayout::{paragraph_builders_from_text, stroke_paragraph_builders_from_text};
|
||||
use crate::tiles::{self, PendingTiles, TileRect};
|
||||
use crate::uuid::Uuid;
|
||||
use crate::view::Viewbox;
|
||||
@@ -541,13 +542,18 @@ impl RenderState {
|
||||
let inner_shadows = shape.inner_shadow_paints();
|
||||
let blur_filter = shape.image_filter(1.);
|
||||
let blur_mask = shape.mask_filter(1.);
|
||||
let mut paragraphs =
|
||||
text_content.to_paragraphs(blur_filter.as_ref(), blur_mask.as_ref(), None);
|
||||
let mut paragraphs = paragraph_builders_from_text(
|
||||
&text_content,
|
||||
blur_filter.as_ref(),
|
||||
blur_mask.as_ref(),
|
||||
None,
|
||||
);
|
||||
|
||||
// Render all drop shadows if there are no visible strokes
|
||||
if !shape.has_visible_strokes() && !drop_shadows.is_empty() {
|
||||
for drop_shadow in &drop_shadows {
|
||||
let mut paragraphs_with_drop_shadows = text_content.to_paragraphs(
|
||||
let mut paragraphs_with_drop_shadows = paragraph_builders_from_text(
|
||||
&text_content,
|
||||
blur_filter.as_ref(),
|
||||
blur_mask.as_ref(),
|
||||
Some(drop_shadow),
|
||||
@@ -564,8 +570,9 @@ impl RenderState {
|
||||
text::render(self, &shape, &mut paragraphs, None);
|
||||
for stroke in shape.visible_strokes().rev() {
|
||||
for drop_shadow in &drop_shadows {
|
||||
let mut stroke_paragraphs_with_drop_shadows = text_content
|
||||
.to_stroke_paragraphs(
|
||||
let mut stroke_paragraphs_with_drop_shadows =
|
||||
stroke_paragraph_builders_from_text(
|
||||
&text_content,
|
||||
stroke,
|
||||
&shape.selrect(),
|
||||
blur_filter.as_ref(),
|
||||
@@ -580,7 +587,8 @@ impl RenderState {
|
||||
);
|
||||
}
|
||||
|
||||
let mut stroke_paragraphs = text_content.to_stroke_paragraphs(
|
||||
let mut stroke_paragraphs = stroke_paragraph_builders_from_text(
|
||||
&text_content,
|
||||
stroke,
|
||||
&shape.selrect(),
|
||||
blur_filter.as_ref(),
|
||||
@@ -600,8 +608,9 @@ impl RenderState {
|
||||
);
|
||||
|
||||
for inner_shadow in &inner_shadows {
|
||||
let mut stroke_paragraphs_with_inner_shadows = text_content
|
||||
.to_stroke_paragraphs(
|
||||
let mut stroke_paragraphs_with_inner_shadows =
|
||||
stroke_paragraph_builders_from_text(
|
||||
&text_content,
|
||||
stroke,
|
||||
&shape.selrect(),
|
||||
blur_filter.as_ref(),
|
||||
@@ -618,7 +627,8 @@ impl RenderState {
|
||||
}
|
||||
|
||||
for inner_shadow in &inner_shadows {
|
||||
let mut paragraphs_with_inner_shadows = text_content.to_paragraphs(
|
||||
let mut paragraphs_with_inner_shadows = paragraph_builders_from_text(
|
||||
&text_content,
|
||||
blur_filter.as_ref(),
|
||||
blur_mask.as_ref(),
|
||||
Some(inner_shadow),
|
||||
|
||||
Reference in New Issue
Block a user