Fix very long text not forcibly wrapping at its max width (#4019)

* fix: Very long text does not forcibly wrap at its max width

* Test that a word longer than the max width breaks to stay within it

---------

Co-authored-by: Dennis Kobert <[email protected]>
This commit is contained in:
Jatin BhartiandDennis Kobert authored and Keavon Chambers committed 2026-11-06 14:51:10 -08:00
1 parent c88d9d366f
commit de08019677
2 files changed
+28 -1

No files matched your search

+2 -1
View File
@@ -5,7 +5,7 @@ use core_types::list::List;
use glam::DVec2;
use graphene_resource::{Resource, ResourceHash};
use parley::fontique::{Blob, FamilyId, FontInfo};
use parley::{AlignmentOptions, FontContext, GlyphRun, Layout, LayoutContext, LineHeight, PositionedLayoutItem, StyleProperty};
use parley::{AlignmentOptions, FontContext, GlyphRun, Layout, LayoutContext, LineHeight, OverflowWrap, PositionedLayoutItem, StyleProperty};
use std::collections::HashMap;
use vector_types::Vector;
@@ -134,6 +134,7 @@ impl TextContext {
builder.push_default(StyleProperty::FontStyle(font_info.style()));
builder.push_default(StyleProperty::FontWidth(font_info.width()));
builder.push_default(LineHeight::FontSizeRelative(typesetting.line_height_ratio as f32));
builder.push_default(StyleProperty::OverflowWrap(OverflowWrap::BreakWord));
let mut layout: Layout<()> = builder.build(text);