From 1c7a73fbd40f13ad63c7f7a40c1947e98578895c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 14 Mar 2014 21:47:39 +0000 Subject: babel-french (14mar14) git-svn-id: svn://tug.org/texlive/trunk@33177 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/generic/babel-french/frenchb.lua | 145 --------------------- .../doc/generic/babel-french/frenchb.pdf | Bin 234821 -> 235810 bytes .../source/generic/babel-french/frenchb.dtx | 79 +++++++---- .../tex/generic/babel-french/frenchb.ldf | 55 +++++--- .../tex/generic/babel-french/frenchb.lua | 145 +++++++++++++++++++++ Master/tlpkg/libexec/ctan2tds | 1 + 6 files changed, 234 insertions(+), 191 deletions(-) delete mode 100644 Master/texmf-dist/doc/generic/babel-french/frenchb.lua create mode 100644 Master/texmf-dist/tex/generic/babel-french/frenchb.lua (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/babel-french/frenchb.lua b/Master/texmf-dist/doc/generic/babel-french/frenchb.lua deleted file mode 100644 index c1ce1bb4d8c..00000000000 --- a/Master/texmf-dist/doc/generic/babel-french/frenchb.lua +++ /dev/null @@ -1,145 +0,0 @@ --- --- File `frenchb.lua' generated from frenchb.dtx [2014/02/28 v3.0a] --- --- Copyright (C) 2014 Daniel Flipo --- License LPPL: see frenchb.dtx. --- -local FB_punct_thin = - {[string.byte("!")] = true, - [string.byte("?")] = true, - [string.byte(";")] = true} -local FB_punct_thick = - {[string.byte(":")] = true} -local FB_punct_left = - {[string.byte("!")] = true, - [string.byte("?")] = true, - [string.byte(";")] = true, - [string.byte(":")] = true, - [0xBB] = true} -local FB_punct_right = - {[0xAB] = true} -local FB_punct_null = - {[string.byte("!")] = true, - [string.byte("?")] = true, - [string.byte("[")] = true, - [string.byte("(")] = true, - [0xA0] = true, - [0x202F] = true} -local FB_guil_null = - {[0xA0] = true, - [0x202F] = true} -local new_node = node.new -local copy_node = node.copy -local node_id = node.id -local GLUE = node_id("glue") -local GSPEC = node_id("glue_spec") -local GLYPH = node_id("glyph") -local PENALTY = node_id("penalty") -local nobreak = new_node(PENALTY) -nobreak.penalty = 10000 -local insert_node_before = node.insert_before -local insert_node_after = node.insert_after -local remove_node = nodes.remove -local thin10 = tex.skip['FBthinskip'] -local thinwd = thin10.width/65536/3.33 -local thinst = thin10.stretch/65536/1.665 -local thinsh = thin10.shrink/655.36/1.11 -local coln10 = tex.skip['FBcolonskip'] -local colnwd = coln10.width/65536/3.33 -local colnst = coln10.stretch/65536/1.665 -local colnsh = coln10.shrink/65536/1.11 -local guil10 = tex.skip['FBguillskip'] -local guilwd = guil10.width/65536/3.33 -local guilst = guil10.stretch/65536/1.665 -local guilsh = guil10.shrink/65536/1.11 -local font_table = {} -local function new_glue_scaled (fid,width,stretch,shrink) - local fp = font_table[fid] - if not fp then - font_table[fid] = font.getfont(fid).parameters - fp = font_table[fid] - end - local gl = new_node(GLUE,0) - local gl_spec = new_node(GSPEC) - gl_spec.width = width * fp.space - gl_spec.stretch = stretch * fp.space_stretch - gl_spec.shrink = shrink * fp.space_shrink - gl.spec = gl_spec - return gl -end -local addDPspace = luatexbase.attributes['FB@addDPspace'] -local addGUILspace = luatexbase.attributes['FB@addGUILspace'] -local has_attribute = node.has_attribute -local function french_punctuation (head) - for item in node.traverse_id(GLYPH, head) do - local lang = item.lang - local char = item.char - local SIG = has_attribute(item, addGUILspace) - if lang == FR and FB_punct_left[char] then - local fid = item.font - local prev = item.prev - local prev_id, prev_subtype, prev_char - if prev then - prev_id = prev.id - prev_subtype = prev.subtype - if prev_id == GLYPH then - prev_char = prev.char - end - end - local glue = prev_id == GLUE and prev_subtype == 0 - if FB_punct_thin[char] or FB_punct_thick[char] then - local SBDP = has_attribute(item, addDPspace) - local fbglue - if FB_punct_thick[char] then - fbglue = new_glue_scaled(fid,colnwd,colnst,colnsh) - else - fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh) - end - local auto = - SBDP and SBDP > 0 and - (prev_char and not FB_punct_null[prev_char]) or - (not prev_char and (prev_id ~= 0 or prev_subtype ~= 3)) - if glue or auto then - if glue then - head = remove_node(head,prev,true) - end - insert_node_before(head, item, copy_node(nobreak)) - insert_node_before(head, item, copy_node(fbglue)) - end - elseif SIG and SIG > 0 then - if glue or (prev_char and not FB_guil_null[prev_char]) then - if glue then - head = remove_node(head,prev,true) - end - local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) - insert_node_before(head, item, copy_node(nobreak)) - insert_node_before(head, item, copy_node(fbglue)) - end - end - end - if lang == FR and FB_punct_right[char] and SIG and SIG > 0 then - local next = item.next - local next_id, next_subtype, next_char - if next then - next_id = next.id - next_subtype = next.subtype - if next_id == GLYPH then - next_char = next.char - end - end - local glue = next_id == GLUE and next_subtype == 0 - if glue or (next_char and not FB_guil_null[next_char]) then - if glue then - head = remove_node(head,next,true) - end - local fid = item.font - local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) - insert_node_after(head, item, copy_node(fbglue)) - insert_node_after(head, item, copy_node(nobreak)) - end - end - end - return head -end -return french_punctuation --- End of File frenchb.lua. diff --git a/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf b/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf index 3ca90183bc8..f11b7aebac8 100644 Binary files a/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf and b/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf differ diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx index abad36efa2c..2bb07d3ce57 100644 --- a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx +++ b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx @@ -1,4 +1,4 @@ -%\CheckSum{3052} +%\CheckSum{3066} % %\iffalse % Tell the \LaTeX\ system who we are and write an entry on the @@ -13,14 +13,14 @@ %\ProvidesLanguage{frenchb} %\ProvidesFile{frenchb.dtx} %<*!lua> - [2014/02/28 v3.0a French support from the babel system] + [2014/03/14 v3.0b French support from the babel system] % %<*internal> \iffalse % %<*lua> -- --- File `frenchb.lua' generated from frenchb.dtx [2014/02/28 v3.0a] +-- File `frenchb.lua' generated from frenchb.dtx [2014/03/14 v3.0b] -- -- Copyright (C) 2014 Daniel Flipo -- License LPPL: see frenchb.dtx. @@ -75,6 +75,10 @@ \providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX} \hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX} \lefthyphenmin=2 \righthyphenmin=3 +\AtEndDocument{% + \GlossaryPrologue{\section{{Change History}}}% + \clearpage\PrintChanges +} \begin{document} \setlength{\parindent}{0pt} \GetFileInfo{frenchb.dtx} @@ -87,7 +91,6 @@ \end{center} \vspace{2\baselineskip} \thispagestyle{empty} -\GlossaryPrologue{\section{{Change History}}} \tableofcontents \clearpage \DocInput{frenchb.dtx} @@ -1073,25 +1076,34 @@ % The following part holds specific code for punctuation with modern % LuaTeX engines (version $\ge 0.76$). % +% \changes{v3.0b}{2014/02/13}{Require luatexbase with LaTeXe in case +% fontspec has not been loaded before babel.} +% % We define two LuaTeX attributes to control spacing in French % for `high punctuation' and quotes, making sure that % |\newluatexattribute| is defined. % \begin{macrocode} \ifFB@luatex@punct - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname newluatexattribute\endcsname\relax - \input luaotfload.sty - \fi - \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax - \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax \ifLaTeXe + \AtEndOfPackage{% + \RequirePackage{luatexbase}% + \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax + \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax + } \PackageInfo{frenchb.ldf}{No need for active punctuation characters% \MessageBreak with this version of LuaTeX!% \MessageBreak reported} \else - \fb@info{No need for active punctuation characters\\ - with this version of LuaTeX!} + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname newluatexattribute\endcsname\relax + \input luaotfload.sty + \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax + \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax + \fb@info{No need for active punctuation characters\\ + with this version of LuaTeX!} + \fi \fi +\fi % \end{macrocode} % % \iffalse @@ -1158,7 +1170,7 @@ local nobreak = new_node(PENALTY) nobreak.penalty = 10000 local insert_node_before = node.insert_before local insert_node_after = node.insert_after -local remove_node = nodes.remove +local remove_node = node.remove % \end{macrocode} % Some variables to store |\FBthinskip|, |\FBcolonskip| and % |\FBguillskip| (given for |lmr10|); width/stretch/shrink are @@ -1333,6 +1345,7 @@ return french_punctuation % warning reminding the user that active characters are no longer % used in French with recent LuaTeX engines. % \begin{macrocode} +\ifFB@luatex@punct \newcommand*{\FB@luatex@punct@french}{% \ifx\shorthandoffORI\@undefined \let\shorthandonORI\shorthandon @@ -1360,6 +1373,11 @@ return french_punctuation \FB@addto{extras}{\FB@luatex@punct@french} \FB@addto{noextras}{\FB@luatex@punct@nonfrench} % \end{macrocode} +% +% \changes{v3.0b}{2014/02/13}{frenchb.lua was not found by +% Lua function dofile (not kpathsea aware). +% Call function kpse.find\_file first, as suggested by Paul Gaborit.} +% % In \LaTeXe, file \file{frenchb.lua} will be loaded % `AtBeginDocument' \emph{after} processing options % (\fbo{ThinColonSpace} needs to be taken into account). The next @@ -1370,20 +1388,27 @@ return french_punctuation % (|\hbox| building). % \begin{macrocode} \def\activate@luatexpunct{% - \directlua{% - FR = \the\l@french - local f = dofile("frenchb.lua") - luatexbase.add_to_callback("pre_linebreak_filter", - f, "frenchb.french_punctuation",1) - luatexbase.add_to_callback("hpack_filter", - f, "frenchb.french_punctuation",1) - }% - } -% \end{macrocode} -% End of specific code for punctuation with LuaTeX engines. -% \begin{macrocode} + \directlua{% + FR = \the\l@french + local path = kpse.find_file("frenchb.lua", "lua") + if path then + local f = dofile(path) + luatexbase.add_to_callback("pre_linebreak_filter", + f, "frenchb.french_punctuation",1) + luatexbase.add_to_callback("hpack_filter", + f, "frenchb.french_punctuation",1) + else + texio.write_nl('') + texio.write_nl('*****************************') + texio.write_nl('Error: frenchb.lua not found.') + texio.write_nl('*****************************') + texio.write_nl('') + end + }% + } \fi % \end{macrocode} +% End of specific code for punctuation with LuaTeX engines. % % \subsubsection{Punctuation with XeTeX} % \label{sssec-punct-xetex} @@ -1751,11 +1776,12 @@ return french_punctuation \FBAutoSpacePunctuationtrue} \def\NoAutoSpaceBeforeFDP{\noautospace@beforeFDP \FBAutoSpacePunctuationfalse} + \AtEndOfPackage{\AutoSpaceBeforeFDP} \else \let\AutoSpaceBeforeFDP\autospace@beforeFDP \let\NoAutoSpaceBeforeFDP\noautospace@beforeFDP + \AutoSpaceBeforeFDP \fi -\AutoSpaceBeforeFDP % \end{macrocode} % \end{macro} % \end{macro} @@ -4141,5 +4167,4 @@ return french_punctuation % \fi % % \Finale -% \clearpage\PrintChanges \endinput diff --git a/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf b/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf index 910bab413da..2862ce94b67 100644 --- a/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf +++ b/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf @@ -33,7 +33,7 @@ %% extension .ins) which are part of the distribution. %% \ProvidesLanguage{frenchb} - [2014/02/28 v3.0a French support from the babel system] + [2014/03/14 v3.0b French support from the babel system] %% %% File `frenchb.ldf' %% Babel package for LaTeX version 2e @@ -185,20 +185,27 @@ \newskip\FBthinskip \FBthinskip=1.66672pt \relax \ifFB@luatex@punct - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname newluatexattribute\endcsname\relax - \input luaotfload.sty - \fi - \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax - \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax \ifLaTeXe + \AtEndOfPackage{% + \RequirePackage{luatexbase}% + \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax + \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax + } \PackageInfo{frenchb.ldf}{No need for active punctuation characters% \MessageBreak with this version of LuaTeX!% \MessageBreak reported} \else - \fb@info{No need for active punctuation characters\\ - with this version of LuaTeX!} + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname newluatexattribute\endcsname\relax + \input luaotfload.sty + \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax + \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax + \fb@info{No need for active punctuation characters\\ + with this version of LuaTeX!} + \fi \fi +\fi +\ifFB@luatex@punct \newcommand*{\FB@luatex@punct@french}{% \ifx\shorthandoffORI\@undefined \let\shorthandonORI\shorthandon @@ -226,15 +233,24 @@ \FB@addto{extras}{\FB@luatex@punct@french} \FB@addto{noextras}{\FB@luatex@punct@nonfrench} \def\activate@luatexpunct{% - \directlua{% - FR = \the\l@french - local f = dofile("frenchb.lua") - luatexbase.add_to_callback("pre_linebreak_filter", - f, "frenchb.french_punctuation",1) - luatexbase.add_to_callback("hpack_filter", - f, "frenchb.french_punctuation",1) - }% - } + \directlua{% + FR = \the\l@french + local path = kpse.find_file("frenchb.lua", "lua") + if path then + local f = dofile(path) + luatexbase.add_to_callback("pre_linebreak_filter", + f, "frenchb.french_punctuation",1) + luatexbase.add_to_callback("hpack_filter", + f, "frenchb.french_punctuation",1) + else + texio.write_nl('') + texio.write_nl('*****************************') + texio.write_nl('Error: frenchb.lua not found.') + texio.write_nl('*****************************') + texio.write_nl('') + end + }% + } \fi \newcount\FB@interchartokenstateORI \ifFB@xetex@punct @@ -415,11 +431,12 @@ \FBAutoSpacePunctuationtrue} \def\NoAutoSpaceBeforeFDP{\noautospace@beforeFDP \FBAutoSpacePunctuationfalse} + \AtEndOfPackage{\AutoSpaceBeforeFDP} \else \let\AutoSpaceBeforeFDP\autospace@beforeFDP \let\NoAutoSpaceBeforeFDP\noautospace@beforeFDP + \AutoSpaceBeforeFDP \fi -\AutoSpaceBeforeFDP \ifLaTeXe %\let\ttfamilyORI\ttfamily %\let\rmfamilyORI\rmfamily diff --git a/Master/texmf-dist/tex/generic/babel-french/frenchb.lua b/Master/texmf-dist/tex/generic/babel-french/frenchb.lua new file mode 100644 index 00000000000..7d0ffb50de4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/babel-french/frenchb.lua @@ -0,0 +1,145 @@ +-- +-- File `frenchb.lua' generated from frenchb.dtx [2014/03/14 v3.0b] +-- +-- Copyright (C) 2014 Daniel Flipo +-- License LPPL: see frenchb.dtx. +-- +local FB_punct_thin = + {[string.byte("!")] = true, + [string.byte("?")] = true, + [string.byte(";")] = true} +local FB_punct_thick = + {[string.byte(":")] = true} +local FB_punct_left = + {[string.byte("!")] = true, + [string.byte("?")] = true, + [string.byte(";")] = true, + [string.byte(":")] = true, + [0xBB] = true} +local FB_punct_right = + {[0xAB] = true} +local FB_punct_null = + {[string.byte("!")] = true, + [string.byte("?")] = true, + [string.byte("[")] = true, + [string.byte("(")] = true, + [0xA0] = true, + [0x202F] = true} +local FB_guil_null = + {[0xA0] = true, + [0x202F] = true} +local new_node = node.new +local copy_node = node.copy +local node_id = node.id +local GLUE = node_id("glue") +local GSPEC = node_id("glue_spec") +local GLYPH = node_id("glyph") +local PENALTY = node_id("penalty") +local nobreak = new_node(PENALTY) +nobreak.penalty = 10000 +local insert_node_before = node.insert_before +local insert_node_after = node.insert_after +local remove_node = node.remove +local thin10 = tex.skip['FBthinskip'] +local thinwd = thin10.width/65536/3.33 +local thinst = thin10.stretch/65536/1.665 +local thinsh = thin10.shrink/655.36/1.11 +local coln10 = tex.skip['FBcolonskip'] +local colnwd = coln10.width/65536/3.33 +local colnst = coln10.stretch/65536/1.665 +local colnsh = coln10.shrink/65536/1.11 +local guil10 = tex.skip['FBguillskip'] +local guilwd = guil10.width/65536/3.33 +local guilst = guil10.stretch/65536/1.665 +local guilsh = guil10.shrink/65536/1.11 +local font_table = {} +local function new_glue_scaled (fid,width,stretch,shrink) + local fp = font_table[fid] + if not fp then + font_table[fid] = font.getfont(fid).parameters + fp = font_table[fid] + end + local gl = new_node(GLUE,0) + local gl_spec = new_node(GSPEC) + gl_spec.width = width * fp.space + gl_spec.stretch = stretch * fp.space_stretch + gl_spec.shrink = shrink * fp.space_shrink + gl.spec = gl_spec + return gl +end +local addDPspace = luatexbase.attributes['FB@addDPspace'] +local addGUILspace = luatexbase.attributes['FB@addGUILspace'] +local has_attribute = node.has_attribute +local function french_punctuation (head) + for item in node.traverse_id(GLYPH, head) do + local lang = item.lang + local char = item.char + local SIG = has_attribute(item, addGUILspace) + if lang == FR and FB_punct_left[char] then + local fid = item.font + local prev = item.prev + local prev_id, prev_subtype, prev_char + if prev then + prev_id = prev.id + prev_subtype = prev.subtype + if prev_id == GLYPH then + prev_char = prev.char + end + end + local glue = prev_id == GLUE and prev_subtype == 0 + if FB_punct_thin[char] or FB_punct_thick[char] then + local SBDP = has_attribute(item, addDPspace) + local fbglue + if FB_punct_thick[char] then + fbglue = new_glue_scaled(fid,colnwd,colnst,colnsh) + else + fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh) + end + local auto = + SBDP and SBDP > 0 and + (prev_char and not FB_punct_null[prev_char]) or + (not prev_char and (prev_id ~= 0 or prev_subtype ~= 3)) + if glue or auto then + if glue then + head = remove_node(head,prev,true) + end + insert_node_before(head, item, copy_node(nobreak)) + insert_node_before(head, item, copy_node(fbglue)) + end + elseif SIG and SIG > 0 then + if glue or (prev_char and not FB_guil_null[prev_char]) then + if glue then + head = remove_node(head,prev,true) + end + local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) + insert_node_before(head, item, copy_node(nobreak)) + insert_node_before(head, item, copy_node(fbglue)) + end + end + end + if lang == FR and FB_punct_right[char] and SIG and SIG > 0 then + local next = item.next + local next_id, next_subtype, next_char + if next then + next_id = next.id + next_subtype = next.subtype + if next_id == GLYPH then + next_char = next.char + end + end + local glue = next_id == GLUE and next_subtype == 0 + if glue or (next_char and not FB_guil_null[next_char]) then + if glue then + head = remove_node(head,next,true) + end + local fid = item.font + local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) + insert_node_after(head, item, copy_node(fbglue)) + insert_node_after(head, item, copy_node(nobreak)) + end + end + end + return head +end +return french_punctuation +-- End of File frenchb.lua. diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 4f07fdbf23f..458a3a895ab 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1331,6 +1331,7 @@ $standardtex='\.(.bx|cfg|sty|clo|ldf|cls|def|fd|cmap|4ht)$'; 'apacite', '\.apc|' . $standardtex, 'arabtex', '\.tex|' . $standardtex, 'babel', 'bl?plain\.tex|' . $standardtex, + 'babel-french', '\.lua|' . $standardtex, 'babel-georgian', 'georgiancaps\.tex|' . $standardtex, 'babelbib', '\.bdf|\.sty', 'bangtex', 'bangfont\.tex|' . $standardtex, -- cgit v1.2.3