|
|
Home » U++ Library support » RichText,QTF,RTF... » Allow line-break after '-' sign within a word?
Allow line-break after '-' sign within a word? [message #40448] |
Fri, 02 August 2013 16:39 |
zsolt
Messages: 698 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
My problem is, that I have some very long words with multiple '-' signs and I want to allow line breaking after '-' signs.
E. g. I have a word like this: this-is-a-long-word-with-a-lot-of-minus-signs and it would be at the end of a line like:
some text ........................... this-is-a-long-word-
with-a-lot-of-minus-signs
So is it possible to change line breaking somhow or is there a non printing character allowing line break within a word?
Or can I change the rendering code? Where can I find this line breaking logic in U++ code?
|
|
|
Re: Allow line-break after '-' sign within a word? [message #40450 is a reply to message #40448] |
Sat, 03 August 2013 08:38 |
|
Hi zsolt,
If you talk about DocEdit, then the responsible code is in DocEdit::Format(const WString& text) const, in CtrlLib/DocEdit.cpp.
I think that you'd just need to add check for '-' in this part: if(*s == ' ' || *s == '\t') {
space = s;
spacex = x + cw;
*s = ' ';
}
I did not try it, but it should be quite straightforward
Best regards,
Honza
|
|
|
|
|
|
|
Re: Allow line-break after '-' sign within a word? [message #40477 is a reply to message #40476] |
Tue, 06 August 2013 22:03 |
Sender Ghost
Messages: 301 Registered: November 2008
|
Senior Member |
|
|
zsolt wrote on Tue, 06 August 2013 20:35 | Maybe it would be a good idea to apply this change to the SVN version as well. Hm?
|
As far as I know, not all words with hyphen character must be line-break, especially for languages different than english, while RichText is UTF-aware.
For example, for unicode character set there are:
- soft-hypen, to manually "hint" about line break.
- non-breaking hyphen and no-break-space, to forbid line break.
- etc.
Also, the Hyphen Wikipedia page mentions about "minus sign", which "should not be confused with" hyphen.
Not to mention about many hyphenation algorithms (e.g. "Liang-Knuth hyphenation algorithm", which uses specially created patterns for selected languages; algorithms, based on vowels, consonants, syllables, etc.).
[Updated on: Tue, 06 August 2013 22:26] Report message to a moderator
|
|
|
|
|
|
Re: Allow line-break after '-' sign within a word? [message #41006 is a reply to message #40548] |
Sat, 19 October 2013 19:06 |
wimpie
Messages: 46 Registered: March 2013 Location: holland
|
Member |
|
|
mirek wrote on Sun, 11 August 2013 18:04 | Also, we might consider adding automated hyphenation too... (but that will have to have support in LanguageInfo).
|
I think it's a good idea to support word-breaking at QTF level with invisible characters indicating where the words may break. (soft-hyphen)
But automation should be in the (word processing) editor where typed words may be inserted with the soft-hyphen. in my experience the computer is not always right, so you should be able to remove the soft-hyphen by hand if you like. (or add it...)
|
|
|
Goto Forum:
Current Time: Sat Sep 21 04:32:30 CEST 2024
Total time taken to generate the page: 0.03847 seconds
|
|
|