69 Commits

Author SHA1 Message Date
Laurenz
6c478face4 Fix paragraph constraints
Co-Authored-By: Martin <mhaug@live.de>
2021-09-27 11:38:18 +02:00
Laurenz
19e17cc6ac Simplify decoration handling 2021-09-26 12:43:45 +02:00
Laurenz
a493b9533a More useful Debug impls 2021-09-26 12:24:24 +02:00
Laurenz
5594868f8b Prevent paragraph from overflowing due to trailing linebreak 2021-09-25 23:35:27 +02:00
Laurenz
18190f377a Reimplement Debug for layout nodes 2021-09-10 15:10:35 +02:00
Laurenz
148a06c070 Switch from state to decorations for underline/strikethrough/overline 2021-08-24 00:41:15 +02:00
Martin
d546453880
Links! (#43)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
2021-08-23 23:56:33 +02:00
Laurenz
c0377de653 Shorter/clearer field name for geometry types
Size { width, height } => Size { w, h }
Spec { horizontal, vertical } => Spec { x, y }
Gen { cross, main } => Gen { inline, block }
2021-08-21 19:08:47 +02:00
Laurenz
0dd4ae0a7a Prune derives 2021-08-21 17:30:21 +02:00
Laurenz
594809e35b Library functions behave more imperatively
- Templates scope state changes
- State-modifying function operate in place instead of returning a template
- Internal template representation contains actual owned nodes instead of a pointer to a syntax tree + an expression map
- No more wide calls
2021-08-17 22:20:37 +02:00
Laurenz
9a798ce6f6 Make percentages for h and v relative to area instead of font size 2021-08-17 00:17:28 +02:00
Laurenz
2c6127dea6 Refactor state 2021-07-29 13:28:19 +02:00
Laurenz
312dcd070c Move EcoString and OptionExt into util 2021-07-29 11:35:49 +02:00
Laurenz
c97b3078eb Merge font and par state into text state 2021-07-25 12:10:44 +02:00
Laurenz
adb71ee040 Move and refactor 2021-07-25 01:03:38 +02:00
Laurenz
6a4823461f Reference-count complex values
Rename some nodes types
2021-07-10 23:10:17 +02:00
Laurenz
36b3067c19 Eco string 🌱 2021-07-10 13:07:39 +02:00
Laurenz
02b586cc36 Add lots of Eq impls 2021-07-08 23:16:02 +02:00
Laurenz
65c0c5607e Make clippy a bit happier 2021-06-30 11:48:51 +02:00
Martin Haug
21d919e2d2 Put incremental compilation behind feature 2021-06-29 12:33:24 +02:00
Martin Haug
e9960b8942 Code review: Reverse temperature 2021-06-27 18:58:31 +02:00
Martin Haug
9bd8b7ddac Code review, new stack test 2021-06-27 18:06:39 +02:00
Martin
57bd3e23c7
Apply suggestions from code review
Co-authored-by: Laurenz <laurmaedje@gmail.com>
2021-06-27 17:08:40 +02:00
Martin Haug
6b6cdae7ce Testing for incremental
Also, constraint bugfixes.
2021-06-27 12:31:27 +02:00
Martin
80a9b300d1 Ref count the frames 2021-06-18 13:01:55 +02:00
Martin
e14e804789
Constraints (#31) 2021-06-17 14:18:43 +02:00
Laurenz
e2cdda67dc Refactor grid row layout 2021-06-15 16:34:41 +02:00
Laurenz
a61ee46ed2 Refactor column resolving 2021-06-13 00:22:39 +02:00
Laurenz
4017b5a9f6 Push some nodes directly into the stack 2021-06-11 14:42:20 +02:00
Laurenz
3330767c20 Remove props in favor of using state for everything 2021-06-11 11:30:18 +02:00
Martin Haug
c28708aa19 Text decorations 2021-06-10 23:15:51 +02:00
Martin Haug
e27f6c1014 Add hash impls for all nodes
This prepares the incremental PR.

Co-Authored-By: Laurenz <laurmaedje@gmail.com>
2021-05-26 22:57:29 +02:00
Laurenz
6472c1e425 Rename areas to regions 2021-05-21 12:55:36 +02:00
Laurenz
8d67c0ca5e Convert font units to lengths earlier 2021-05-17 23:06:31 +02:00
Laurenz
c975d0d5e9 Tidy up layouting code 2021-05-17 22:55:31 +02:00
Laurenz
1003d320d4 Rename expand to fixed and switch to bools 2021-05-17 15:00:29 +02:00
Laurenz
3d2ee54848 Refactor and comment ♻ 2021-04-07 01:08:07 +02:00
Laurenz
de20a21a58 Reshaping with unsafe-to-break
Co-Authored-By: Martin <mhaug@live.de>
2021-04-05 22:32:09 +02:00
Laurenz
9014e83478 Fix multi-page paragraph bugs 🐞 2021-04-03 21:12:32 +02:00
Laurenz
d74c9378b8 New paragraph layout 🚀
The previous paragraph layout algorithm had a couple of flaws:
- It always produced line break opportunities between runs although on
  the textual level there might have been none.
- It didn't handle trailing spacing correctly in some cases.
- It wouldn't have been easily adaptable to Knuth-Plass style optimal
  line breaking because it was fundamentally structured first-fit
  run-by-run.

The new paragraph layout algorithm fixes these flaws. It proceeds
roughly in the following stages:
1. Collect all text in the paragraph.
2. Compute BiDi embedding levels.
3. Shape all runs, layout all children and store the resulting items in
   a reusable (possibly even cacheable) `ParLayout`.
3. Iterate over all line breaks in the concatenated text.
4. Construct lightweight `LineLayout` objects for full lines instead of
   runs. These mostly borrow from the `ParLayout` and only reshape the
   first and last run if necessary. The design allows to use Harfbuzz's
   UNSAFE_TO_BREAK mechanism to make reshaping more efficient. The size
   of a `LineLayout` can be measured without building the line's frame.
5. Build only the selected line's frames and stack them.
2021-04-03 21:09:17 +02:00
Laurenz
8245b7b736 Baseline alignment ⏏ 2021-03-30 21:43:12 +02:00
Laurenz
c00cca3677 Refactor ♻ 2021-03-30 16:19:16 +02:00
Laurenz
79948c0c5e BiDi reordering 🔃
Co-Authored-By: Martin <mhaug@live.de>
2021-03-30 14:31:50 +02:00
Laurenz
c393eccd36 Fix space/newline trimming 🐞
Co-Authored-By: Martin <mhaug@live.de>
2021-03-30 14:31:46 +02:00
Laurenz
652986fd58 Fix double leading 🐞 2021-03-30 14:31:39 +02:00
Laurenz
88da325c7d Fixed par layouter directions 🗜 2021-03-29 15:02:15 +02:00
Laurenz
309b8f20a8 Line break iterating run shaper 🌵
Co-Authored-By: Martin <mhaug@live.de>
2021-03-29 15:02:15 +02:00
Laurenz
8c27dc1010 Write spaces and linebreaks into text runs ✒ 2021-03-29 15:02:15 +02:00
Laurenz
57ca9628c1 Better space coalescing logic 🌧
This creates a smaller state machine helper type for softness coalescing, which does not own the resulting nodes. While this creates a bit more duplication in stack and par builder, it makes it a lot easier to integrate additional logic into the paragraph builder.

Furthermore:
- Line breaks are now "hard", that is, not coalesced with each other.
- Text nodes with equal style are now merged allowing for example `f{}i` to form a ligature.
2021-03-27 21:52:39 +01:00
Laurenz
76fc4cca62 Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
2021-03-25 21:32:33 +01:00