-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enhancements #4
Comments
Per bramstein/typeset#30, it would be very good, if an otherwise unbreakable word (or fragment) is longer than the entire available line, to break it at some arbitrary point so that it does fit. First try condensing the text with charspace() and/or hscale(), by a reasonable amount. If that isn't enough to fit it, try breaking at "reasonable" points, such as between a lowercase and an uppercase letter (camelCase text) or a letter and a number, or next to some punctuation. Finally, if all else fails, break where it would just fit into the line. This might be improved by looking at what happens to the remainder of the text, if splitting a bit earlier (to the left) results in an overall better appearance. Note that this might not fit into the standard Knuth-Plass boxes & glue structure, as it would have to be done on an ad hoc basis, as a word or fragment larger than the current line is encountered. Remember than line lengths may vary, so it's difficult to presplit the word. Also, there is the issue of unsplittable words or fragments that are not longer than the line, but moving them to the next line will result in unacceptably large stretching to fit the current line. It might be better to go ahead and force a split (with appropriate penalty) than to accept such wide spaces between words (very, very loose line)! |
It might be cleanest to take any "word" over 8 or so characters, and force a split in (or near) Text::Hyphen, should that module be otherwise unable to split up the word. Split first at hyphens and dashes, then at camelCase, then between letters and digits, maybe then around punctuation, and finally (if any chunks longer than 8 characters are left) every 3 or 4 characters. Just make sure at least 2 are left in the leftmost, and 3 in the rightmost. This would then fit in with the standard Knuth-Plass box and glue structure. |
|
Knuth-Plass can request that spaces (glue) be stretched or shrunk to tune the length of the line (justification). For extreme stretching and/or shrinking, it might look better if intercharacter spacing could be adjusted ( For extreme stretching or condensing, PDF::Builder has the Add: Another thought -- for PDF::Builder usage (not necessarily in general), if KP gives the same glue (spacing) size between all words in a line (with the same stretch or shrink), the Add: If using Add: Be careful with some languages and typographic customs, as s p a c e d l e t t e r s may be used for emphasis. If an entire line is charspace'd that may not be too bad, but still it could accidentally "hide" emphasis (deliberate extra spacing), or make it appear that an entire line is emphasized. |
Per bramstein/typeset#27, and #5, it sounds like it would be useful to at least be able to change some parameter values at Add: Quite a few parameters already were modifiable, but undocumented. I have added them to the POD. Maybe more are lurking out there somewhere! |
In line with number (1) above, and specification of line lengths in general, keep in mind that a page-fitting system might want to slightly increase or decrease a page's leading in order to deal with widows and orphans. This might have an undesirable effect on line lengths intended to fit around images and other inserts, as the specific lines indented might now begin and end a little early or late. To fit a single line, this might not be too visible, and no special treatment might be needed, but don't forget it. It's possible that once in a while some manual intervention might be needed. Or, feed back notice that the leading was changed, and adjust all image and insert y-locations? While on the subject, what if (1)'s break point ends up producing a widow? Since the penultimate line should not be hyphenated anyway, that might not be too bad. A wrap-around for KP that handles these things should probably accept image/insert dimensions in points anyway, so that it can float them up and down as leading changes, and set line lengths on-the-fly. We just want to avoid having to go back and rerun KP on a page multiple times to fine tune placement.
|
Rather than giving a set of line lengths to use (or in addition to...), give a vertical length (and width) of indentation and a starting offset from the top of the paragraph. Return any unused indentation for use by the next paragraph (the wrapper would handle this). How to extend this to non-rectangular situations? This would include the various examples of triangular, circular, etc. paragraphs, and non-rectangular cutouts for images and asides. A possibility would be to define a path (lines, arcs, splines) bounding the paragraph, with some provision to allow an indefinite continuation on the bottom. For PDF::Builder (PDF generation), I want to do something like this anyway for arbitrary paragraph shapes, so maybe we can kill two birds with one stone. Any "path" defining a non-rectangular overall paragraph is going to have the problem of what to do when leading gets tweaked to avoid a widow or orphan... which will change the shape of all paragraphs on the page! This, in turn, could even change the line breaking to create or eliminate widows and orphans. |
I have seen suggestions that hyphenation use soft hyphens (SHY) rather than - for the output. This way, screen readers and reflow/reformatters (editors) can realize that the hyphen isn't real, and can be omitted when gluing the word back together. Of course, there's still the issue of Dutch/German (etc.) repeating or adding letters when splitting words, which would need to be corrected when reforming the split words! See #2. |
See also
[/forum/general-12/textknuthplass-general-discussion/]for general discussions of direction of Text::KnuthPlass package.Forum is closed down. Roadmap and discussions here at GitHub.
The text was updated successfully, but these errors were encountered: