-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
epaint: Break up memozation of text layouts into paragraphs #4000
base: master
Are you sure you want to change the base?
Conversation
My two cents: The current Paragraph struct is misnamed, as it refers to a block of text that will be split into lines, not a typographic paragraph "/n/n". TextBlock would be a more appropriate name. When generating the TextBlocks, only the X positioning of glyphs is calculated. The Y positions are ignored at this stage. Line breaks happen later when converting TextBlocks to Rows, based on the wrap width. A TextBlock can span multiple Rows if it exceeds the wrap width. To properly position the wrapped Rows vertically, each TextBlock needs a paragraph index that is incremented for each one. When generating the Rows in line_break(), the paragraph (TextBlock ) index can be used to increment the Y position, so Rows from the same TextBlock are offset vertically. This prevents the issue of Rows overlapping each other at the same Y position when breaking a TextBlock into multiple Rows. So in summary, the TextBlocks are intermediate storage of positioned glyphs before line wrapping. The line breaks and Y positioning happen in a later stage when converting TextBlocks to Rows. |
Huh, it says your comment was posted on the 10th, but I've been regularly checking this PR and it didn't appear for me until today. Weird. Anyway, it looks like all use of the My main question is: what is the frame of reference for the rendering positions inside a |
Maybe instead of using egui/crates/epaint/src/text/text_layout.rs Lines 68 to 122 in 3672b15
|
I dont get the solution, may be my problem is different than solving here. I want to show BIG 2 megabytes text, so why just dont virtualize lines, and make user pass big text as And make selection api as Range<(row, col)> |
Draft for now, I just want to confirm that I'm on the right track for the general logic, and make sure I know about the edge cases when splitting
LayoutJob
s and mergingGalley
s. It looks like I will need to:LayoutSection
s go into eachLayoutJob
, and change their offsetsLayoutJob
ends with a newlineGalley
s, merge therect
s andmesh_bounds
of eachGalley
together, and possibly offset them?elided
field makes it onto the fullGalley
if set on any paragraph, and stop adding the followingGalley
s if that field is setnum_vertices
andnum_indices
The code compiles right now, but does not pass
cargo cranky
and panics immediately when that codepath is run (byte index out of bounds, probably due to not filtering and offsettingLayoutSection
s. Also thetodo!()
.)TextEdit
#3086