Thread: Regex examples
View Single Post
Old 06-29-2013, 09:11 PM   #261
BangBangO
Junior Member
BangBangO began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by roger64 View Post
Hi

I have one wish that could be of interest for French users. We currently use   before the following punctuation signs : ; ! ? and inside the French quotes and before an endnotes call. Seven possible occurences (at least for punctuation purposes, because there are other uses of this entity).

However, our typographic rules suggest to use - preferably - a narrow no-break space that we call "espace fine insécable".

When? Before the three following double punctuation signs ; ! ? and inside the French quotes and before an endnotes call. Six possible occurences.

However, this entity is mishandled by ADE and other -old generation- ebook-readers, even if we use appropriate fonts. So, for the time being, it's a little useless.

That's why, meanwhile some people try to emulate this narrow no-break space from the no-break space. I found two CSS solutions for this. Admittedly they are not optimal because they will leave a lot of spans. At least, it's a choice.

L'émulation 1
texte<span class=«fine»>&nbsp;</span>texte
Code CSS:
.fine {font-size: 30%;}
L'émulation 2
</span class=«fine»>&nbsp;</span>
Code CSS:
.fine {display:inline-block;width:0.125em}

I would like to have an advice which of the two seems better?
I also would like to use one Regex to search and replace &nbsp; using one of the two span classes above.

If I make a plain search and replace, it would have to be played six times. I hope there is a Regex to wrap everything and play it only once.

Phew, it was a long post but I tried to be clear. Thank you for your help.
Sorry for being so late but I've just discovered this while browsing this topic.

What you were trying to do must be considered bad practice for several reasons :

— Adobe's “rendering engine” is already doing that automatically (if average word-spacing is OK). You’ll just get a thin of a thin space.

— this can screw iBooks' hyphenation quite insanely (and iBooks' hyphenation is just already terrible in French).

— there is an insane bug since ADE 2.0 (and this bug also occurs in the readers and apps using the same version of the RMSDK) : if a tagged element happens to be at the end of the line and there is no space left, then it will be displayed on the following line.
In this particular case, it means that the non-breaking space will be ignored because there is a span “fine”. As a result you are rewarded with something like this :

Code:
L’animal s'excitait ŕ la vue du sang. Comment vais-je m'en sortir 
? se demanda Jean.
Text-align doesn't matter, (this sh)it happens.

There are some fixes for this incredible bug but they're not (EPUB 2) specs-compliant. Moreover, it's Adobe’s business as they obviously messed up.

Hope that helps, because every time I discover those span “fine” in a file, I just get rid of them as they will create problems when I read the book.


By the way, your second emulation is not specs-compliant. Display: inline-block, though supported widely, is not part of the EPUB 2 specs.
BangBangO is offline   Reply With Quote