Scribus Forums

Scribus => Text and Typography => Topic started by: JLuc on March 14, 2024, 12:55:45 PM

Title: Prevent linebreaks and hyphen in some short texts (emails)
Post by: JLuc on March 14, 2024, 12:55:45 PM
I wish i could prevent linebreaks and hyphens in some specified text.

emails should not be hyphenated. hyphenation is hard to distinguish from a real included dash.
+ sometime emails include a dot or a dash like my.na-me@provid.er but i dont want any linebreak or hyphen to break any part of that text.

Idealy this would be achieved with text having a specific character style. But i dont thing it is possible as for now. Is there a way ?

Possibly using a script ?
Title: Re: Prevent linebreaks and hyphen in some short texts (emails)
Post by: a.l.e on March 14, 2024, 05:13:34 PM
the "standard" way for avoiding the hyphenation of a word is to put a soft hyphen in front of the word.

a long time ago cezary even made a patch for it:

https://bugs.scribus.net/view.php?id=10517

according to the comments in the ticket, scribus seems to already have some code that tries to implement it but fails...
Title: Re: Prevent linebreaks and hyphen in some short texts (emails)
Post by: a.l.e on March 14, 2024, 11:24:12 PM
i have a trivial two lines patch against the current code that prevents "Extras > Hyphenate" from hyphenating words that start with a soft hyphen.

i have to check what happens when "hyphenate while typing" is on.
if you first type the soft hyphen, it seems to respect it.
when you go back and add it later, then the word gets hyphenated.

finally, i think that we also should make the soft hyphens visible when the control chars are shown...
does anybody have a suggestion on how to do it?
i've checked libre office and it adds an hyphen with a dark gray background. sadly, this changes the layout so i don't think it will be a solution that can be used in scribus.

ps.: note to self: a vertical light gray bar before between the letters could be a good solution...
Title: Re: Prevent linebreaks and hyphen in some short texts (emails)
Post by: a.l.e on March 17, 2024, 11:38:04 AM
i've uploaded the "trivial" patch:

https://bugs.scribus.net/view.php?id=10517#c51045

like the best wines, it will get better after a few years in the mantis cellar...

i've also added a short analysis on how the hyphenation of single words can be prevented in scribus:


this won't allow you to avoid a line break, since scribus does not allow the text to go outside of the frame.