Skip to content

Enhancement request: when line-wrapping, recognize '/' (slash) as a character for word splitting #171

Description

@kcalcagno

When the library finds it needs to wrap a line to make it fit in a cell, it first tries to split on words and then, if a particular word still won't fit, it splits the word with a hyphen. PdfUtil.wrapLine splits the line into words with the following regex: (?<=[\\. ,-]). (A zero-width lookbehind for backslash, period, space, comma, or hyphen.)

I recommend that we also add / (forward slash) to that regex. This would help split words that are connected as alternatives (like "either/or") as well as URLs and (Unix-style) file paths whose segments are delimited with /. (Only guessing, but I would imagine backslash is in there for Windows-style paths.)

Happy to submit a PR if you like, though it's a one-character change. (And a new unit test.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions