Skip to content

Throw exception instead of arbitrarily chopping long words #1297

@C-Dargel

Description

@C-Dargel

Is your feature request related to a problem? Please describe.
If I see this correctly, BidiLine.processLine() handles placing of text in lines internally (e. g. for a ColumnText). If it encounters a long string that won't fit in the current line, it arbitrarily chops it into (at least) two pieces and fits the first in the current line, continuing with the rest in the next line.
If my ColumnText would only fit one line, I could use the result of go() to determine if my string would overflow (NO_MORE_COLUMN). If it is just one word in a longer text that still fits entirely in my, say, ten possible lines, I have no way of knowing that something was possibly chopped until I see the result.

Describe the solution you'd like
I would prefer a simple error message telling me the string longestwordimaginable does not fit the line width.

In my use case I would decrease the font size by one and try again until everything either fits in lines or I reach a given minimum font size limit (and then throw an exception to hand that information to the user).

Describe alternatives you've considered
I first thought I could use a custom SplitCharacter implementation to get the desired result, but that did obviously not work.
Hyphenation is not feasible because we have no way of knowing the language of the input text as of now.

Your real name
Christopher Dargel

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions