diff options
Diffstat (limited to 'tex/context/base/mkiv/typo-del.mkiv')
-rw-r--r-- | tex/context/base/mkiv/typo-del.mkiv | 118 |
1 files changed, 75 insertions, 43 deletions
diff --git a/tex/context/base/mkiv/typo-del.mkiv b/tex/context/base/mkiv/typo-del.mkiv index d12be6bcf..2ce98841e 100644 --- a/tex/context/base/mkiv/typo-del.mkiv +++ b/tex/context/base/mkiv/typo-del.mkiv @@ -71,35 +71,48 @@ \setnewconstant\boundarycharactermode\plusone +% old: skip symbol skip +% new: bound skip symbol skip bound + \unexpanded\def\midboundarycharacter#1#2% {\ifcase\boundarycharactermode \or - %\nobreak + \removeunwantedspaces + \wordboundary \hskip\hspaceamount\currentusedlanguage{#2}% \usedlanguageparameter#1% - %\nobreak \hskip\hspaceamount\currentusedlanguage{#2}% + \wordboundary + \ignorespaces \or \usedlanguageparameter#1% \fi \boundarycharactermode\plusone} +% old: symbol nobreak skip +% new: symbol nobreak skip wordboundary + \unexpanded\def\leftboundarycharacter#1#2% {\ifcase\boundarycharactermode \or \usedlanguageparameter#1% \nobreak - \hskip\hspaceamount\currentusedlanguage{#2}% + \hskip\hspaceamount\currentusedlanguage{#2}% why not a kern + \wordboundary \or \usedlanguageparameter#1% \fi \boundarycharactermode\plusone} +% old: preword skip symbol +% new: bound nobreak skip symbol + \unexpanded\def\rightboundarycharacter#1#2% {\ifcase\boundarycharactermode \or - \prewordbreak %\nobreak - \hskip\hspaceamount\currentusedlanguage{#2}% + \wordboundary + \nobreak + \hskip\hspaceamount\currentusedlanguage{#2}% why not a kern \usedlanguageparameter#1% \or \usedlanguageparameter#1% @@ -212,10 +225,15 @@ %D \typebuffer %D \getbuffer -\unexpanded\def\startsubsentence{\beginofsubsentence\prewordbreak\beginofsubsentencespacing\typo_subsentence_cleanup_start} -\unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\endofsubsentencespacing\prewordbreak\endofsubsentence} -\unexpanded\def\subsentence {\groupedcommand\startsubsentence\stopsubsentence} -\unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\prewordbreak\midsentence\prewordbreak\typo_subsentence_cleanup_stop} +%unexpanded\def\startsubsentence{\beginofsubsentence\prewordbreak\beginofsubsentencespacing\typo_subsentence_cleanup_start} +%unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\endofsubsentencespacing\prewordbreak\endofsubsentence} +%unexpanded\def\subsentence {\groupedcommandcs\startsubsentence\stopsubsentence} +%unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\prewordbreak\midsentence\prewordbreak\typo_subsentence_cleanup_stop} + +\unexpanded\def\startsubsentence{\beginofsubsentence\wordboundary\beginofsubsentencespacing\wordboundary\typo_subsentence_cleanup_start} +\unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\wordboundary\endofsubsentencespacing\wordboundary\endofsubsentence} +\unexpanded\def\subsentence {\groupedcommandcs\startsubsentence\stopsubsentence} +\unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\wordboundary\midsentence\wordboundary\typo_subsentence_cleanup_stop} \definehspace [quotation] [\zeropoint] \definehspace [interquotation] [.125em] @@ -277,6 +295,8 @@ \let\currentdelimitedtext\s!unknown +\installglobalmacrostack\currentdelimitedtext + \let\delimitedtextlevel\!!zerocount \def\c_typo_delimited_nesting{\csname\??delimitedtextlevel\currentparentdelimitedtext\endcsname} @@ -301,6 +321,8 @@ \let\currentdelimitedlanguage\empty +\installglobalmacrostack\currentdelimitedlanguage + \def\typo_delimited_set_language_nop {\setusedlanguage{\delimitedtextparameter\c!language}} @@ -333,8 +355,8 @@ \let\m_delimited_argument\empty} \def\typo_delimited_push#1#2% - {\globalpushmacro\currentdelimitedtext % can we combine these two - \globalpushmacro\currentdelimitedlanguage % the language used for hyphenation + {\push_macro_currentdelimitedtext % can we combine these two + \push_macro_currentdelimitedlanguage % the language used for hyphenation \edef\currentdelimitedtext{#1}% \edef\m_delimited_argument{#2}% \ifx\m_delimited_argument\empty @@ -350,8 +372,8 @@ \def\typo_delimited_pop {\global\advance\c_typo_delimited_nesting\minusone - \globalpopmacro\currentdelimitedlanguage - \globalpopmacro\currentdelimitedtext} + \pop_macro_currentdelimitedlanguage + \pop_macro_currentdelimitedtext} \installcorenamespace{delimitedtext} \installcorenamespace{delimitedtextlevel} @@ -414,6 +436,8 @@ \dostoptagged \ignorespaces} +\newconditional\c_typo_delimited_repeating + \def\typo_delimited_start_other {\edef\p_delimited_repeat{\delimitedtextparameter\c!repeat}% \ifx\p_delimited_repeat\v!yes @@ -421,6 +445,7 @@ \else \let\typo_delimited_repeat\relax \fi + \setfalse\c_typo_delimited_repeating \edef\p_delimited_location{\delimitedtextparameter\c!location}% \ifx\p_delimited_location\v!paragraph \singleexpandafter\typo_delimited_start_par @@ -493,7 +518,7 @@ \let\typo_delimited_stop_par_indeed\stopnarrower \fi % so far - \pushmacro\checkindentation + \push_macro_checkindentation \useindentingparameter\delimitedtextparameter % \begingroup @@ -515,7 +540,7 @@ {\typo_delimited_stop_content \rightdelimitedtextmark \carryoverpar\endgroup % new per 2013-01-21 ... please left floats - \popmacro\checkindentation + \pop_macro_checkindentation \typo_delimited_stop_par_indeed \delimitedtextparameter\c!after \edef\p_delimited_spaceafter{\delimitedtextparameter\c!spaceafter}% @@ -680,30 +705,37 @@ % test test test % \stoptext -\def\typo_delimited_handle_middle#1% - {\typo_delimited_stop_content - \begingroup - \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor - \setbox\scratchbox\hbox{\delimitedtextparameter#1}% - \ifdim\wd\scratchbox>\zeropoint - \ifdim\lastkern=\d_typo_delimited_signal - \unkern - \hskip\hspaceamount\currentusedlanguage{interquotation}% +% We have no real test case for this and it's broken already for a while, +% even in \MKII. Maybe we should to this in \LUA. Only Italian has the +% middlespeech parameter set. + +\def\typo_delimited_handle_middle#1% special case + {\ifconditional\c_typo_delimited_repeating + \begingroup + \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor + \setbox\scratchbox\hbox{\delimitedtextparameter#1}% + \ifdim\wd\scratchbox>\zeropoint + \ifdim\lastkern=\d_typo_delimited_signal + \unkern + \hskip\hspaceamount\currentusedlanguage{interquotation}% + \else % maybe an option: + %\edef\p_delimited_margin{\delimitedtextparameter\c!location}% + %\ifx\p_delimited_margin\v!margin + % \hskip-\wd\scratchbox + %\fi + \fi + \strut % new, needed below + \dostarttagged\t!delimitedsymbol\empty + \dotagsetdelimitedsymbol\s!middle + \delimitedtextparameter#1% unhbox\scratchbox + \dostoptagged + % \penalty\plustenthousand % else overfull boxes, but that's better than dangling periods + \kern\d_typo_delimited_signal % +- \prewordbreak \fi - \ifhmode % else funny pagebeaks - \penalty\plustenthousand - \hskip\zeropoint % == \prewordbreak - \fi - \strut % new, needed below - \dostarttagged\t!delimitedsymbol\empty - \dotagsetdelimitedsymbol\s!middle - \delimitedtextparameter#1% unhbox\scratchbox - \dostoptagged - % \penalty\plustenthousand % else overfull boxes, but that's better than dangling periods - \kern\d_typo_delimited_signal % +- \prewordbreak - \fi - \endgroup - \typo_delimited_start_content} + \endgroup + \else + \settrue\c_typo_delimited_repeating + \fi} \def\typo_delimited_handle_left#1% {\begingroup @@ -717,11 +749,11 @@ \unskip \hskip\hspaceamount\currentusedlanguage{interquotation}% \fi\fi - \strut % new, needed below - \ifhmode % else funny pagebeaks - \penalty\plustenthousand - \hskip\zeropoint % == \prewordbreak - \fi + % \strut % new, needed below + % \ifhmode % else funny pagebeaks + % \penalty\plustenthousand + % \hskip\zeropoint % == \prewordbreak + % \fi \strut % new, needed below \dostarttagged\t!delimitedsymbol\empty \dotagsetdelimitedsymbol\s!left |