-
Notifications
You must be signed in to change notification settings - Fork 12
Description
One example where this library doesn't work well:
have a Paragraph with some inline spans that have different styling (e.g. bold, different fontSize etc.)
currently the library assumes styling is uniform across paragraph.
The way to solve this is to offer an API function that work per Span and not per Paragraph, but being able to pass on constraints. Such as for a given "line" how much of the available space is blocked already (could encode it as vectors, e.g. if line width is 100, 0-20 blocked, 60-80 blocked etc).
This would also allow Text to "wrap around" objects (e.g. image inside text), which is currently not possible with HTML / CSS.
The result of this advanced function call could be used for Canvas or SVG text rendering.
Essentially for a given Array of Spans with different Style and array of line blocking vector (which one could manually precompute), one wants returned an array of "TextFragments", that each have their own bounding box, X and Y etc.