Skip to content

Commit

Permalink
\flq, \glq, etc., now work with TU.
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier committed Nov 26, 2017
1 parent 9727164 commit b3f45a4
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 90 deletions.
162 changes: 72 additions & 90 deletions required/babel/babel.dtx
Expand Up @@ -35,9 +35,9 @@
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
\setmainfont[Scale=.89]{DejaVu Serif}
\setsansfont[Scale=.87]{DejaVu Sans}
\setmonofont[Scale=.87]{DejaVu Sans Mono}
\setmainfont[Scale=.88]{Noto Serif}
\setsansfont[Scale=.88]{Noto Sans}
\setmonofont[Scale=.88,FakeStretch=.95]{Noto Mono}
\raggedright
\addtolength{\textwidth}{25pt}
\addtolength{\textheight}{3.5cm}
Expand All @@ -54,7 +54,7 @@
\meta{language}\texttt{,}\meta{language}\texttt{,}...}
\newcommand*\langvar{\m{lang}}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\Lenv[1]{\textsf{#1}}
\newcommand*\Lenv[1]{\texttt{#1}}
\newcommand*\menv[1]{\char`\{#1\char`\}}
\newcommand*\Eenv[1]{%
\quad\ldots\quad
Expand Down Expand Up @@ -492,7 +492,7 @@ In Plain, load languages styles with |\input| and then use
\subsection{Basic language selectors}

This section describes the commands to be used in the document to
switch the language in multilingual document. In most cases, only the
switch the language in multilingual documents. In most cases, only the
two basic macros |\selectlanguage| and |\foreignlanguage| are
necessary. The environments |otherlanguage|, |otherlanguage*| and
|hyphenrules| are auxiliary, and described in the next section.
Expand Down Expand Up @@ -1774,7 +1774,7 @@ Mono} \fi}
\begin{verbatim}
\documentclass{article}

\usepackage[swedish]{babel}
\usepackage[swedish, bidi=default]{babel}

\babelprovide[import=he]{hebrew}

Expand Down Expand Up @@ -6879,6 +6879,9 @@ help from Bernd Raichle, for which I am grateful.
%
% Shorthands are provided for a number of different quotation
% marks, which make them usable both outside and inside mathmode.
% They are defined with |\ProvideTextCommandDefault|, but this is
% very likely not required because their definitions are based on
% encoding dependent macros.
%
% \begin{macro}{\glq}
% \begin{macro}{\grq}
Expand All @@ -6889,11 +6892,8 @@ help from Bernd Raichle, for which I am grateful.
% The `german' single quotes.
%
% \begin{macrocode}
\ProvideTextCommand{\glq}{OT1}{%
\ProvideTextCommandDefault{\glq}{%
\textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
\ProvideTextCommand{\glq}{T1}{%
\textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
\ProvideTextCommandDefault{\glq}{\UseTextSymbol{OT1}\glq}
% \end{macrocode}
%
% The definition of |\grq| depends on the fontencoding. With
Expand All @@ -6902,10 +6902,12 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\ProvideTextCommand{\grq}{T1}{%
\textormath{\textquoteleft}{\mbox{\textquoteleft}}}
\ProvideTextCommand{\grq}{TU}{%
\textormath{\textquoteleft}{\mbox{\textquoteleft}}}
\ProvideTextCommand{\grq}{OT1}{%
\save@sf@q{\kern-.0125em%
\textormath{\textquoteleft}{\mbox{\textquoteleft}}%
\kern.07em\relax}}
\save@sf@q{\kern-.0125em
\textormath{\textquoteleft}{\mbox{\textquoteleft}}%
\kern.07em\relax}}
\ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
% \end{macrocode}
%
Expand All @@ -6921,23 +6923,22 @@ help from Bernd Raichle, for which I am grateful.
% The `german' double quotes.
%
% \begin{macrocode}
\ProvideTextCommand{\glqq}{OT1}{%
\ProvideTextCommandDefault{\glqq}{%
\textormath{\quotedblbase}{\mbox{\quotedblbase}}}
\ProvideTextCommand{\glqq}{T1}{%
\textormath{\quotedblbase}{\mbox{\quotedblbase}}}
\ProvideTextCommandDefault{\glqq}{\UseTextSymbol{OT1}\glqq}
% \end{macrocode}
%
% The definition of |\grqq| depends on the % fontencoding. With
% The definition of |\grqq| depends on the fontencoding. With
% \texttt{T1} encoding no extra kerning is needed.
%
% \begin{macrocode}
\ProvideTextCommand{\grqq}{T1}{%
\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
\ProvideTextCommand{\grqq}{TU}{%
\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
\ProvideTextCommand{\grqq}{OT1}{%
\save@sf@q{\kern-.07em%
\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
\kern.07em\relax}}
\save@sf@q{\kern-.07em
\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
\kern.07em\relax}}
\ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
% \end{macrocode}
%
Expand All @@ -6953,19 +6954,10 @@ help from Bernd Raichle, for which I am grateful.
% The `french' single guillemets.
%
% \begin{macrocode}
\ProvideTextCommand{\flq}{OT1}{%
\ProvideTextCommandDefault{\flq}{%
\textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
\ProvideTextCommand{\flq}{T1}{%
\textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
\ProvideTextCommandDefault{\flq}{\UseTextSymbol{OT1}\flq}
% \end{macrocode}
%
% \begin{macrocode}
\ProvideTextCommand{\frq}{OT1}{%
\textormath{\guilsinglright}{\mbox{\guilsinglright}}}
\ProvideTextCommand{\frq}{T1}{%
\ProvideTextCommandDefault{\frq}{%
\textormath{\guilsinglright}{\mbox{\guilsinglright}}}
\ProvideTextCommandDefault{\frq}{\UseTextSymbol{OT1}\frq}
% \end{macrocode}
%
% \end{macro}
Expand All @@ -6980,19 +6972,10 @@ help from Bernd Raichle, for which I am grateful.
% The `french' double guillemets.
%
% \begin{macrocode}
\ProvideTextCommand{\flqq}{OT1}{%
\textormath{\guillemotleft}{\mbox{\guillemotleft}}}
\ProvideTextCommand{\flqq}{T1}{%
\ProvideTextCommandDefault{\flqq}{%
\textormath{\guillemotleft}{\mbox{\guillemotleft}}}
\ProvideTextCommandDefault{\flqq}{\UseTextSymbol{OT1}\flqq}
% \end{macrocode}
%
% \begin{macrocode}
\ProvideTextCommand{\frqq}{OT1}{%
\ProvideTextCommandDefault{\frqq}{%
\textormath{\guillemotright}{\mbox{\guillemotright}}}
\ProvideTextCommand{\frqq}{T1}{%
\textormath{\guillemotright}{\mbox{\guillemotright}}}
\ProvideTextCommandDefault{\frqq}{\UseTextSymbol{OT1}\frqq}
% \end{macrocode}
%
% \end{macro}
Expand Down Expand Up @@ -7505,6 +7488,47 @@ help from Bernd Raichle, for which I am grateful.
\bbl@replace@finish@iii\bbl@toreplace}
% \end{macrocode}
%
% Language and Script values to be used when defining a font or
% setting the direction are set with the following macros.
%
% \begin{macrocode}
\def\bbl@provide@lsys#1{%
\bbl@ifunset{bbl@lname@#1}%
{\bbl@ini@ids{#1}}%
{}%
\bbl@csarg\let{lsys@#1}\@empty
\bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}%
\bbl@ifunset{bbl@sotf#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}%
\bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}%
\bbl@ifunset{bbl@lname@#1}{}%
{\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}%
\bbl@csarg\bbl@toglobal{lsys@#1}}%
% \bbl@exp{% TODO - should be global
% \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl@cs{sname@#1}}%
% {\\\newfontscript{\bbl@cs{sname@#1}}{\bbl@cs{sotf@#1}}}%
% \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl@cs{lname@#1}}%
% {\\\newfontlanguage{\bbl@cs{lname@#1}}{\bbl@cs{lotf@#1}}}}}
% \end{macrocode}
%
% The following |ini| reader ignores everything but the
% |identification| section. It is called when a font is defined (ie,
% when the language is first selected) to know which script/language
% must be enabled. This means we must make sure a few characters are
% not active. The |ini| is not read directly, but with a proxy |tex|
% file named as the language.
%
% \begin{macrocode}
\def\bbl@ini@ids#1{%
\def\BabelBeforeIni##1##2{%
\begingroup
\bbl@add\bbl@secpost@identification{%
\def\bbl@iniline########1\bbl@iniline{}}%
\catcode`\[=12 \catcode`\]=12 \catcode`\==12
\bbl@read@ini{##1}%
\endgroup}
\InputIfFileExists{babel-#1.tex}{}{}}
% \end{macrocode}
%
% \subsection{Cross referencing macros}
%
% The \LaTeX\ book states:
Expand Down Expand Up @@ -8330,7 +8354,6 @@ help from Bernd Raichle, for which I am grateful.
% (reserved for hyphenation).}
% \changes{3.15}{2017/10/30}{Store direction in @wdir@<lang>.}
%
%
% \begin{macrocode}
\def\bbl@alscripts{,Arabic,Syriac,Thaana,}
\def\bbl@rscripts{%
Expand All @@ -8352,6 +8375,7 @@ help from Bernd Raichle, for which I am grateful.
\global\bbl@csarg\chardef{wdir@#1}\z@
\fi}
\def\bbl@switchdir{%
\bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
\bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
\bbl@exp{\\\bbl@setdirs\bbl@cs{wdir@\languagename}}}
\def\bbl@setdirs#1{% TODO - math
Expand All @@ -8361,8 +8385,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@pardir{#1}%
\fi
\bbl@textdir{#1}}
\ifcase\bbl@engine
\or
\ifodd\bbl@engine
\AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
\DisableBabelHook{babel-bidi}
\def\bbl@getluadir#1{%
Expand All @@ -8389,7 +8412,7 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@bodydir{\bbl@setdir{body}\bodydir}
\def\bbl@pagedir{\bbl@setdir{page}\pagedir}
\def\bbl@dirparastext{\pardir\the\textdir\relax}% %%%%
\or
\else
\AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
\DisableBabelHook{babel-bidi}
\newcount\bbl@dirlevel
Expand Down Expand Up @@ -9809,12 +9832,12 @@ help from Bernd Raichle, for which I am grateful.
\AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
\DeclareOption{bidi=default}%
{\let\bbl@beforeforeign\leavevmode
\ifcase\bbl@engine\or
\ifodd\bbl@engine
\newattribute\bbl@attr@dir
\fi
\AtEndOfPackage{%
\EnableBabelHook{babel-bidi}%
\ifcase\bbl@engine\or\or
\ifodd\bbl@engine\else
\bbl@xebidipar
\fi}}
%<</More package options>>
Expand Down Expand Up @@ -9919,47 +9942,6 @@ help from Bernd Raichle, for which I am grateful.
\bbl@toglobal#1}%
% \end{macrocode}
%
% Language and Script values to be used when defining a font are set
% with the following macros.
%
% \begin{macrocode}
\def\bbl@provide@lsys#1{%
\bbl@ifunset{bbl@lname@#1}%
{\bbl@ini@ids{#1}}%
{}%
\bbl@csarg\let{lsys@#1}\@empty
\bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}%
\bbl@ifunset{bbl@sotf#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}%
\bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}%
\bbl@ifunset{bbl@lname@#1}{}%
{\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}%
\bbl@csarg\bbl@toglobal{lsys@#1}}%
% \bbl@exp{% TODO - should be global
% \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl@cs{sname@#1}}%
% {\\\newfontscript{\bbl@cs{sname@#1}}{\bbl@cs{sotf@#1}}}%
% \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl@cs{lname@#1}}%
% {\\\newfontlanguage{\bbl@cs{lname@#1}}{\bbl@cs{lotf@#1}}}}}
% \end{macrocode}
%
% The following |ini| reader ignores everything but the
% |identification| section. It is called when a font is defined (ie,
% when the language is first selected) to know which script/language
% must be enabled. This means we must make sure a few characters are
% not active. The |ini| is not read directly, but with a proxy |tex|
% file named as the language.
%
% \begin{macrocode}
\def\bbl@ini@ids#1{%
\def\BabelBeforeIni##1##2{%
\begingroup
\bbl@add\bbl@secpost@identification{%
\def\bbl@iniline########1\bbl@iniline{}}%
\catcode`\[=12 \catcode`\]=12 \catcode`\==12
\bbl@read@ini{##1}%
\endgroup}
\InputIfFileExists{babel-#1.tex}{}{}}
% \end{macrocode}
%
% font@rst and famrst are only used when there is no global settings,
% to save and restore de previous families. Not really necessary, but
% done for optimization.
Expand Down
Binary file modified required/babel/babel.pdf
Binary file not shown.

0 comments on commit b3f45a4

Please sign in to comment.