| Issue 98: | Inline literal text is always hyphenated | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
In my rst2pdf stylesheet I have set
["literal" , {
"parent": "normal",
"fontName": "stdMono",
...,
"hyphenation": false
}],
because I do not want inline literal text to be hyphenated. However, the
hyphenation attribute seems to be ignored for inline styles.
I have also opened this as wordaxe bug 2579940 because it probably will
need changes in wordaxe as well.
|
||||||||||
,
Feb 08, 2009
Yes, hyphenation right now can only be set on the paragraph level. I don't see a way to do anything about it yet. |
|||||||||||
,
Feb 08, 2009
Maybe a future version of wordaxe will support this feature. Here is a link to the corresponding wordaxe issue: https://sourceforge.net/tracker2/?func=detail&aid=2579940&group_id=105867&atid=642478 If we cannot work it out, we should at least document this as a known limitation. |
|||||||||||
,
Feb 08, 2009
Looks like there is yet another bug, in that I am using the "code" style instead of "literal". I'll change that. |
|||||||||||
,
Feb 18, 2009
This simply cannot be done with ReportLab as it is today. RL only stores a fixed set of attributes for "inline styles". As I mentioned in the wordaxe issue, one possible workaround would be to inspect the font instead and disable hyphenation if a fixed-width-font (like Courier) is used. It'd be possible to code this in wordaxe in such a way that the workaround would only be used if explicitly configured that way (by rst2pdf). |
|||||||||||
,
Feb 19, 2009
I was thinking... in the same way there is a soft-hyphen character that says "you can hyphenate here" is there a "don't hyphenate here" character? If there isn't, could we just make one up? Use a VERY useless one, like, the "zero width space" U +200B ;-) Then I insert these everywhere in literals, and wordaxe removes them and doesn´ t hyphenate. |
|||||||||||
,
Feb 19, 2009
I also thought about that, but it's very ugly and unnecessary work for the user. I want my rst texts to be nice and readable and not sprinkled with such chars. (Btw, I think the zero width space is sometimes used to indicate that words *should* be hyphenated there.) I'm actually voting for disabling hyphenation for fixed-size fonts if we don't find a better way. It's a pragmatic solution. Of course it should be configurable. |
|||||||||||
,
Feb 19, 2009
No, the user would not do any work. I take the literal node (and only the literal node), insert U+200B between each character before passing it to wordaxe (if hyphenation is enabled), which then doesn't hyphenate that. One problem with the other proposed solution is that... how can you figure out if a font is fixed-size? |
|||||||||||
,
Feb 19, 2009
Ok, now I understand your idea. Maybe instead we could make Wordaxe's paragraph implementation understand <nobr> tags, and rst2pdf would add these automatically for such paragraphs? |
|||||||||||
,
Feb 19, 2009
If wordaxe can do that, sure, it's trivial on rst2pdf's side |
|||||||||||
,
Feb 20, 2009
I've just posted an experimental patch for wordaxe that makes it understand <nobr>. |
|||||||||||
,
Feb 20, 2009
r509 adds the <nobr> to inline literals. If there's no support for that tag this does nothing anyway :-) |
|||||||||||
,
Feb 21, 2009
Thank you. Henning has already implemented this in Wordaxe and everything works well together now. I have modified this a bit in r510 so that the <nobr> tags for inline literals are only used when the hyphenation attribute in the style is set to false, and made this the default setting. So you can disable this feature if you really want.
Status: Fixed
|
|||||||||||
| ► Sign in to add a comment | |||||||||||