Fluid 0.7.0 has been released!
IchorDev
zxinsworld at gmail.com
Sat Nov 23 11:58:06 UTC 2024
On Monday, 18 November 2024 at 14:27:41 UTC, cookiewitch wrote:
>
> Measurement and rendering uses the `TextRuler` struct (frankly
> more important than the Fluid-centric `StyledText` one we keep
> discussing), which I hope to keep super simple so it can be
> easily manipulated by the user.
Good luck keeping it simple!
> It keeps track of the pen position and text size.
This sounds like it would break when RTL text needs to be
embedded into LTR text. (because RTL text needs to be
right-aligned within the LTR block)
> The idea is `TextRuler` is fed pieces of unbreakable content
> ("words") which may be text, but it can be anything of known
> width. A textual word would be first measured and then placed
> in the ruler to place it in the correct spot in the text.
>
> Whatever manipulates the ruler, like the `Text` struct, could
> handle other pieces through a hook that would run between
> words. I imagine it would have a signature like `void
> delegate(ref TextRuler, WordSize)`. `inline-block`-like content
> (images, buttons, etc.) would increase line height and add a
> single "word" both matching the image's size. `inline` elements
> could add multiple words. `float` content could be simulated by
> inserting a word on every line at its supposed location, and
> thus would even support non-rectangular elements anywhere
> within the line.
What about the majority of languages which do not use spaces? Do
they submit all of their text in one huge block? And surely
basing your rendering idioms around the English concept of a word
is surely a bit exclusionary, no?
> As for `TextRulerCache` I mentioned earlier, I'm almost sure
> I've ironed out all the quirks and bugs. I think it's OK now,
> but certainly coding a pretty weird and complex data structure
> while having a fever wasn't my brightest idea.
Well done! When it becomes its own package I'll have to have a
look at how it's going. :) I might end up doing my own thing if
time allows.
More information about the Digitalmars-d-announce
mailing list