summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/typo-brk.mkiv
blob: 3b463c06f920aa820f75978f6a9a7c82951a5018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%D \module
%D   [       file=typo-brk,
%D        version=2009.03.27, % code moved from core-spa.mkiv
%D          title=\CONTEXT\ Typesetting Macros,
%D       subtitle=Breakpoints,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Typesetting Macros / Breakpoints}

\unprotect

% hm, we cannot prebuild lists, font dependent
%
% -- type nleft nright language left right middle
%
% -- we might eventually stick to only method 5

\registerctxluafile{typo-brk}{1.001}

\definesystemattribute[breakpoint][public,global]

% see below: \exhyphenchar \minusone % we use a different order tha   n base tex, so we really need this

\unexpanded\def\definebreakpoints
  {\dosingleargument\typo_breakpoints_define}

\def\typo_breakpoints_define[#1]%
  {\clf_definebreakpoints{#1}}

\def\definebreakpoint
  {\dotripleempty\typo_breakpoints_define_character}

\def\typo_breakpoints_define_character[#1][#2][#3]% name char settings
  {\begingroup
   \getdummyparameters[\c!type=1,\c!nleft=3,\c!nright=3,\s!language=,\c!left=,\c!right=,\c!middle=,#3]%
   \clf_definebreakpoint
     {#1}%
     {#2}%
     {\reallanguagetag{\directdummyparameter\s!language}}%
     {% maybe deal with #3 at the lua end
          type \directdummyparameter\c!type
         nleft {\directdummyparameter\c!nleft}%
        nright {\directdummyparameter\c!nright}%
         right {\directdummyparameter\c!right}%
          left {\directdummyparameter\c!left}%
        middle {\directdummyparameter\c!middle}%
     }%
   \relax
   \endgroup}

\unexpanded\def\setbreakpoints[#1]%
  {\exhyphenchar\minusone % we use a different order tha   n base tex, so we really need this
   \clf_setbreakpoints{#1}}

\unexpanded\def\resetbreakpoints
  {\attribute\breakpointattribute\attributeunsetvalue}

\definebreakpoints[compound]

\definebreakpoint [compound] [+] [\c!nleft=3,\c!nright=3,\c!type=1] % middle=+,left=,right=
\definebreakpoint [compound] [-] [\c!nleft=3,\c!nright=3,\c!type=1] % middle=+,left=,right=
\definebreakpoint [compound] [/] [\c!nleft=3,\c!nright=3,\c!type=1] % middle=+,left=,right=
\definebreakpoint [compound] [(] [\c!nleft=3,\c!nright=3,\c!type=2] % type=5,middle=(,left=(-,right=
\definebreakpoint [compound] [)] [\c!nleft=3,\c!nright=3,\c!type=3] % type=5,middle=),left=,right=-)

\let\installbreakpoint\definebreakpoint % for a while

% \start \hsize 1.5cm \setbreakpoints[compound]
%     \definebreakpoint [compound] [-] [nleft=3,nright=3,type=5,left=,right={-},middle={-}]
%     \definebreakpoint [compound] [(] [nleft=3,nright=3,type=5,left=,right={(-},middle={(}]
%     \definebreakpoint [compound] [)] [nleft=3,nright=3,type=5,left={-)},right=,middle={)}]
%     composed-word\par composed(word)\par
% \stop

% \mainlanguage[czech]
% \definebreakpoint [compound] [\number`-] [language=cs,nleft=3,nright=3,type=4]
% \setbreakpoints[compound]
% \start \hsize 1mm test-test \par \stop

%D Maybe some day default:
%
% \setbreakpoints[compound]

\protect \endinput