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

Text option to balance line lengths in paragraphs #25832

Open
2 tasks done
shoogle opened this issue Dec 14, 2024 · 0 comments
Open
2 tasks done

Text option to balance line lengths in paragraphs #25832

shoogle opened this issue Dec 14, 2024 · 0 comments
Labels
feature request Used to suggest improvements or new capabilities

Comments

@shoogle
Copy link
Contributor

shoogle commented Dec 14, 2024

Your idea

Add a new text formatting option with these values (e.g. in a dropdown, toggle buttons, or a radio list):

Balance line lengths Rendering
Off Default. As many words as possible are fit onto each line of text, while remaining within the current frame or page margins. The final line in each paragraph may be much shorter than the other lines.
Approximate Lines are automatically broken in the optimum places to ensure all lines within each paragraph are approximately equal in length, including the final line. Lines in one paragraph may be different in length to lines in another paragraph. The same total number of lines is used as with the Off setting.
Exact Same as Approximate except letter spacing and word spacing is automatically adjusted to make line lengths exactly equal. This is similar to full text justification, except lines don't have to occupy the full width between margins.

Here, line length refers to the visual width of a line, not the number of characters it contains.

Obviously, this option is useless without:

Problem to be solved

When text is justified or center-aligned, it looks unbalanced if the length of the final line is very different to the other lines.

This can be avoided by adding manual line breaks as was done in the opening pages of this score:

image

image

image

However, these manual line breaks are only valid for this particular combination of:

  • Font
  • Font size
  • Page size
  • Page margins

If any of these settings are subsequently changed (e.g. when loading a large print accessibility style), the lines may no longer fit between the margins. If that happens (and #23013 is fixed) then automatic breaks would be created in addition to these manual breaks, which could look terrible!

Prior art

LaTeX has a \parfillskip tag that provides similar functionality.

Microsoft Word has options to control whether the final line of a paragraph gets justified along with the other lines. However, it simply stretches the final line to fill the space. It's not clever enough to try moving the linebreaks around.

Additional context

For the MVP, lines would always be broken at word boundaries, but in the future we could allow hypenation (and potentially add another setting to control how aggressively hypenation is applied).

The Balance line lengths setting can be used in conjunction with the alignment setting (Left, Center, Right) to create lines that are approximately equal in length and aligned with one margin or the center of the page.

In future, if we add a Justify alignment option, the effect of length balancing would be to make all lines, including the final line, equal in length and occupy the full width of the page, but with a clever algorithm than Microsoft Word. In this case there would be no difference between Approximate and Exact balancing, but setting it to Off would remove justification of the final line.

Checklist

  • This request follows the guidelines for reporting issues
  • I have verified that this feature request has not been logged before, by searching the issue tracker for similar requests
@muse-bot muse-bot added the feature request Used to suggest improvements or new capabilities label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Used to suggest improvements or new capabilities
Projects
None yet
Development

No branches or pull requests

2 participants