Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct typographic spaces for French (a few tweaks needed) #36

Closed
fvsch opened this issue May 29, 2016 · 9 comments
Closed

Correct typographic spaces for French (a few tweaks needed) #36

fvsch opened this issue May 29, 2016 · 9 comments
Assignees
Milestone

Comments

@fvsch
Copy link

fvsch commented May 29, 2016

Although it’s hard to find precise recommendations for correct spacing around punctuation in French. After reading a lot about “orthotypographie”, I have gathered that the exact rules are:

  1. Full no-break space before the colon (:). (Technically this space should not vary when using text-align:justify, but that’s a browser limitation that wp-typography can do nothing about.)
  2. Narrow no-break space before »;?!.
  3. Narrow no-break space after «.

The meaning of those rules is that a little bit of space around certain punctuation characters is considered more readable (I’ll note that it’s also used by some English language publishers for ;?!, though they tend to prefer thin spaces over the narrow space), and that space should not be too big (not a full space), except for the colon because instead of closing a proposition (like the other characters do) it creates a bridge from one proposition to the next (hence the full space). That’s the rationale I’ve read anyway. :)

Other punctuation signs don’t have extra space, or use regular breaking spaces, and don't concern wp-typography.

Also some publishers, typographers, graphic designers etc. may tweak these rules a bit or a lot, which is a given in any publishing and graphic design environment. For instance I know a typographer who uses «» with hair spaces instead of narrow spaces, and in graphic design many use “English” quotes (“”) for posters or book covers, though novels tend to keep the «» with narrow non-breaking spaces.

Changes that would be needed in php-typography to enable those rules:

Use PHP_Typography::chr['noBreakNarrowSpace'] for doubleGuillemetsFrench quote style:

https://github.com/mundschenk-at/wp-typography/blob/master/php-typography/class-php-typography.php#L301

            'doubleGuillemetsFrench'   => array( 'open'  => $this->chr['guillemetOpen'].$this->chr['noBreakNarrowSpace'],
                                                 'close' => $this->chr['noBreakNarrowSpace'].$this->chr['guillemetClose'] ),

Separate the spacing for the colon (:) from PHP_Typography::regex['frenchPunctuationSpacing']:

https://github.com/mundschenk-at/wp-typography/blob/master/php-typography/class-php-typography.php#L1091

        // french punctuation spacing
        $this->regex['frenchPunctuationSpacing']             = '/(\w+)(\s?)([?!:»])(\s|\Z)/u';
        $this->regex['frenchPunctuationSpacingColon']        = '/(\w+)(\s?)(:)(\s|\Z)/u';

and https://github.com/mundschenk-at/wp-typography/blob/master/php-typography/class-php-typography.php#L2700

        $textnode->data = preg_replace( $this->regex['frenchPunctuationSpacing'],             '$1' . $this->chr['noBreakNarrowSpace'] . '$3$4', $textnode->data );
        $textnode->data = preg_replace( $this->regex['frenchPunctuationSpacingColon'],        '$1' . $this->chr['noBreakSpace'] . '$3$4', $textnode->data );

With those changes, if users activate the narrow no-break spaces, they should get perfect French punctuation spacing with supporting browsers and fonts.

PS: the modified code extracts are for illustrating how the rules could be implemented. I haven’t actually tested them or ran this code. I could perhaps make a PR but that would be in 10 days at best.

@fvsch fvsch changed the title Enable correct typographic spaces for French Correct typographic spaces for French (a few tweaks needed) May 29, 2016
@mundschenk-at
Copy link
Owner

Thanks, no need for a PR.

Do you have any quotes/references for the specific rules? (Not being French, I've looked around on the net and as you wrote, recommendations and practices seem to vary a bit. I'd like to document the reasons for various choices.)

@mundschenk-at
Copy link
Owner

@fvsch, do you have any quotes/references for these specific rules? I'd like to document the reason for the choices made in the code.

@fvsch
Copy link
Author

fvsch commented Jun 28, 2016

Sorry for replying late.

From the works of the late Jean-Pierre Lacroux, French typographer (as well as author and cartoonist):
http://www.orthotypographie.fr/volume-I/date-dynastie.html#Deux-points

La tradition française veut que le deux-points soit situé entre deux espaces égales.
[French tradition calls for the colon to be set in between two spaces of equal width.]

And: http://www.orthotypographie.fr/volume-I/echelle-extrait.html#Espace
(some discussions lower down where Lacroux mentions that a full space before the colon is customary but a medium-sized space between a full one and a thin one can be aesthetically pleasing)

Apparently Wikipédia mentions the French usage of thin space before most high/double punctuation marks, and full space (“espace-mot”) before the colon:

https://fr.wikipedia.org/wiki/Comparatif_des_diff%C3%A9rents_codes_typographiques_francophones

En France, on met une fine avec tous les signes doubles sauf avec le deux-points qui est précédé d’une espace-mot insécable.

And it notes that the colon is not treated separately in Switzerland (for French):

En Suisse, on met une espace fine insécable avant toutes les ponctuations doubles, y compris les deux-points.

Also, it notes that in Québec the thin space before punctuation marks might be replaced by no space at all, especially in settings when thin spaces are not available:

Au Québec, on ne met pas d'espace devant le point d'interrogation, le point d'exclamation et le point-virgule5 ; ou plutôt, l'espace fine (espace insécable réduite) est recommandée, mais si l'on dispose d'un logiciel courant de traitement de texte qui ne propose pas une telle espace, on ne met alors aucune espace6.

(In France, my observation is that if thin spaces are not available, especially online, a full non-breaking space will be used.)

@mundschenk-at
Copy link
Owner

Thank you! (That's a great site, BTW - I think I'll have to start collecting various online typographic references.)

@mikerockett
Copy link

mikerockett commented Jan 4, 2017

This is the setting that's breaking my paragraphs. I have the following extract from the Typeset.js example:

Yjarni Sig­urðardót­tir spoke to NATO from Ice­land yes­ter­day: Light of my life ...

This is adding a non-breaking space before the colon:

Yjarni Sig­urðardót­tir spoke to NATO from Ice­land yes­ter­day : Light of my life ...

Surely this should be off by default as it does not need to happen on the English language?

@mundschenk-at
Copy link
Owner

@mikerockett The setting is off by default. Please open a separate issue to track your situation and provide some additional information about your environment.

@mikerockett
Copy link

mikerockett commented Jan 4, 2017

@mundschenk-at It's on, according to the class:

/**
 * Enables/disables extra whitespace before certain punction marks, as is the French custom.
 *
 * @param bool $on Optional. Default true.
 */
function set_french_punctuation_spacing( $on = true ) {
	$this->settings->set_french_punctuation_spacing( $on );
}

Considering that, is it still worth opening a new issue?

@mundschenk-at
Copy link
Owner

Yes. It's off by default in wp-Typography. (It looks like you'd like to use php-typography as standalone library. Setting your own defaults is strongly encouraged in such a situation.)

@mikerockett
Copy link

I see - that makes sense indeed. I didn't look at the WP-defaults. I have started integrating the standalone library as a replacement to the original by Kingdesk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants