Simon Hausmann
7ba8ea156b
Fix up small TODO comments
2022-03-10 10:51:32 +01:00
Simon Hausmann
51e0d17092
Add a test for elision
2022-03-10 10:51:32 +01:00
Simon Hausmann
33ae882506
Avoid shaping text twice per line when drawing paragraphs
...
Track the glyph range in the TextLine and use that to access the glyph buffer,
instead of calling shape_text() again.
2022-03-10 10:51:32 +01:00
Simon Hausmann
247847cb54
Avoid unnecessary glyph buffer re-allocations
...
Store the result of all text shaping calls in one glyph buffer when laying out a
a paragraph of text.
This paves the way of avoiding unnecessary shape_text calls when processing lines.
2022-03-10 10:51:32 +01:00
Simon Hausmann
35f245687a
Make it possible to build the text layout without unicode linebreak tables
2022-03-10 10:51:32 +01:00
Simon Hausmann
187294c00e
Simplify glyph interface in TextShaper
...
* Impose no bounds on the associated Glyph type
* Report the byte offset only in shape_text - it doesn't belong into an aritrary glyph
* Move querying the advance into the TextShaper, where the MCU implementation can deal with missing glyphs
without storing fallback values in the Glyph type
2022-03-10 10:51:32 +01:00
Simon Hausmann
87431eea95
Make it possible to build without unicode-script
2022-03-10 10:51:32 +01:00
Simon Hausmann
38e26f25ef
Basic elision support
...
TODO:
* alignment for rtl/ltr
* elide only last line for multi-line
2022-03-10 10:51:32 +01:00
Simon Hausmann
8d4c645346
Change the paragraph text layout callback to take glyphs
...
This is needed in the future to avoid duplication shaping and
implementation of features like elision or letter spacing in a shared code.
2022-03-10 10:51:32 +01:00
Simon Hausmann
ff2b38eefb
Minor clean up in paragraph layout
...
Encapsulate the entire loop body in the process_line helper
2022-03-10 10:51:32 +01:00
Simon Hausmann
a947ec1441
Simplify glyph interface
...
The textlayout module does not need to impose the exact glyph struct layout.
This paves the way for glyph based rendering.
2022-03-10 10:51:32 +01:00
Simon Hausmann
42a0f605ad
Add an paragraph layout helper function to the corelib textlayout
...
The objective is to use this in the MCU backend and replace layout_text_lines() in the GL backend in the future.
2022-03-10 10:51:32 +01:00
Simon Hausmann
6748563dc6
Fix non-wrapped text with multiple break opportunities
2022-03-10 10:51:32 +01:00
Simon Hausmann
62d633a572
Add convenience function for measuring paragraph sizes
2022-03-10 10:51:32 +01:00
Simon Hausmann
72186cd891
Make the available width an option
2022-03-10 10:51:32 +01:00
Simon Hausmann
1a73460a6a
Add basic text layout module for use with the MCU
...
This is based on the unicode line breaking algorithm (uses crate for
that), which also supports forced line breaks. The shaping is generic,
so on the MCU side we can do without at first.
2022-03-10 10:51:32 +01:00