My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 98: Inline literal text is always hyphenated
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  c...@online.de
Closed:  Feb 2009
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by c...@online.de, Feb 08, 2009
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.
Comment 1 by roberto.alsina, 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.
Comment 2 by c...@online.de, 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.
Comment 3 by roberto.alsina, 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.
Comment 4 by h.vonbargen, 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).
Comment 5 by roberto.alsina, 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.
Comment 6 by c...@online.de, 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.
Comment 7 by roberto.alsina, 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?
Comment 8 by c...@online.de, 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?
Comment 9 by roberto.alsina, Feb 19, 2009
If wordaxe can do that, sure, it's trivial on rst2pdf's side
Comment 10 by c...@online.de, Feb 20, 2009
I've just posted an experimental patch for wordaxe that makes it understand <nobr>.
Comment 11 by roberto.alsina, Feb 20, 2009
r509 adds the <nobr> to inline literals. If there's no support for that tag this 
does nothing anyway :-)
Comment 12 by c...@online.de, 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

Hosted by Google Code