Bug with French and XeLaTeX

The polyglossia package shipped with Debian 9 (current stable) is hit by this bug: tex.stackexchange.com (missing no-break spaces in French punctuation).

You can work around it in two ways:

Patching polyglossia

This is experimental but appears to work:

Copy the file `gloss-french.ldf` into the local tree.

# amusewiki shell
$ mkdir -p texmf/tex/latex/polyglossia
$ cp /usr/share/texlive/texmf-dist/tex/latex/polyglossia/gloss-french.ldf \
     texmf/tex/latex/polyglossia/gloss-french.ldf
$ texhash `kpsewhich -var-value TEXMFHOME`

And patch the new gloss-french.ldf with this:

--- /usr/share/texlive/texmf-dist/tex/latex/polyglossia/gloss-french.ldf        2016-03-25 23:06:03.000000000 +0100
+++ texmf/tex/latex/polyglossia/gloss-french.ldf        2018-10-14 09:45:47.171843623 +0200
@@ -54,6 +54,13 @@
       \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\nobreak\thinspace}% "»;" -> "» ;"
       \XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :"
       \XeTeXinterchartoks \french@punctthin \french@punctguillend  = {\nobreakspace}% "?»" -> "? »"
+
+      % see https://tex.stackexchange.com/questions/330844/prevent-line-break-before/330848#330848
+      \XeTeXinterchartoks 4095 \french@punctthin = {\xpg@unskip\nobreak\thinspace}%
+      \XeTeXinterchartoks 4095 \french@punctthick = {\xpg@unskip\nobreakspace}%
+      \XeTeXinterchartoks 4095 \french@punctguillend = {\xpg@unskip\nobreakspace}% "  »" -> "~»"
+      \XeTeXinterchartoks \french@punctguillstart 4095 = {\nobreakspace\xpg@nospace}% "«  " -> "«~"
+
     \fi
     }