Skip to content
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

How to place different styled text in one string? #11

Open
RangerMak opened this issue Mar 5, 2020 · 5 comments
Open

How to place different styled text in one string? #11

RangerMak opened this issue Mar 5, 2020 · 5 comments
Assignees

Comments

@RangerMak
Copy link

For example, I want to make some part of text bold styled:
This text contains bold part.

Calling pagesSet.addElement(new PLText(lorem, italicFont12)); will add string with specified font. New call of pagesSet.addElement wall add new string.

PLText don't support markups. Also there is not element what containing list of PLText.

Is it possible to solve this problem with current functional?

@phax phax self-assigned this Mar 5, 2020
@phax
Copy link
Owner

phax commented Mar 5, 2020

Hi, that is currently not possible. I would have needed that myself already a couple of times but was always afraid of the effort :/

@RangerMak
Copy link
Author

I think this problem can be solved by creating of renderable list what containing renderable elements.

All elements of this list should be rendered one after another.
After rendering of first element we need to save its end position. This position will be start offset for next element of list. And so on.
Using offset of first line in lines preparing function helps to place rendered element into proper position.
Also offset of first line in lines preparing function can solve indent issue (see #9).

What do you think about this?

The problem for justify alignment.
If text have justify alignment its need to check if current element of list is last?
Last element aligns as usual.
But i don't know how to make justify alignment of current element when we don't know length of next element.

@phax
Copy link
Owner

phax commented Mar 6, 2020

Well we could go for "inline elements" only, so all subclasses of AbstractPLInlineElement. Inline elements usually don't have an alignment (the alignment of PLText is somehow special), and a "list of inline elements with alignment" could be a subtask.

I don't think this would help for #9, because of the "more intelligent indentation" required for multiline bullet point values. But having this "sequence of inline elements" sure could be used as the basis for other elements. But special ligature handling etc. will be an issue, but an issue to deal with at a later point in time

@RangerMak
Copy link
Author

By talking about #9 i mean text flowing around indent (like in Word document).

If indent element will be "inline element" (AbstractPLInlineElement) with specified size (length) then it can be placed at begin of "list of inline elements".
So we can receive text flow around this element.

This solution not for bullet point lists.

@stale
Copy link

stale bot commented Jun 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 8, 2020
@phax phax added pinned and removed wontfix labels Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants