typo-brk.mkiv /size: 3551 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=typo-brk,
3%D        version=2009.03.27, % code moved from core-spa.mkiv
4%D          title=\CONTEXT\ Typesetting Macros,
5%D       subtitle=Breakpoints,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Typesetting Macros / Breakpoints}
15
16\unprotect
17
18% hm, we cannot prebuild lists, font dependent
19%
20% -- type nleft nright language left right middle
21%
22% -- we might eventually stick to only method 5
23
24\registerctxluafile{typo-brk}{}
25
26\definesystemattribute[breakpoint][public,global]
27
28% see below: \exhyphenchar \minusone % we use a different order tha   n base tex, so we really need this
29
30\unexpanded\def\definebreakpoints
31  {\dosingleargument\typo_breakpoints_define}
32
33\def\typo_breakpoints_define[#1]%
34  {\clf_definebreakpoints{#1}}
35
36\def\definebreakpoint
37  {\dotripleempty\typo_breakpoints_define_character}
38
39\def\typo_breakpoints_define_character[#1][#2][#3]% name char settings
40  {\begingroup
41   \getdummyparameters
42     [\c!type=\plusone,\c!nleft=\plusthree,\c!nright=\plusthree,%
43      \s!language=,\c!left=,\c!right=,\c!middle=,\c!range=\v!no,%
44      #3]%
45   \clf_definebreakpoint
46     {#1}%
47     {#2}%
48     {\reallanguagetag{\directdummyparameter\s!language}}%
49     {% maybe deal with #3 at the lua end
50          type \directdummyparameter\c!type
51         nleft \directdummyparameter\c!nleft
52        nright \directdummyparameter\c!nright
53         right {\directdummyparameter\c!right}%
54          left {\directdummyparameter\c!left}%
55        middle {\directdummyparameter\c!middle}%
56        range  {\directdummyparameter\c!range}%
57     }%
58   \relax
59   \endgroup}
60
61\unexpanded\def\setbreakpoints[#1]%
62  {\exhyphenchar\minusone % we use a different order than base tex, so we really need this
63   \clf_setbreakpoints{#1}}
64
65\unexpanded\def\resetbreakpoints
66  {\exhyphenchar\hyphenasciicode % 2020.03.05
67   \c_attr_breakpoint\attributeunsetvalue}
68
69\definebreakpoints[compound]
70
71% 1: simple break
72% 6: simple break but skip same
73
74\definebreakpoint [compound] [+] [\c!nleft=3,\c!nright=3,\c!type=1]                 % middle=+,left=,right=
75%definebreakpoint [compound] [-] [\c!nleft=3,\c!nright=3,\c!type=1,\c!range=\v!yes] % middle=+,left=,right=
76\definebreakpoint [compound] [-] [\c!nleft=3,\c!nright=3,\c!type=6,\c!range=\v!yes] % middle=+,left=,right=
77\definebreakpoint [compound] [/] [\c!nleft=3,\c!nright=3,\c!type=1]                 % middle=+,left=,right=
78\definebreakpoint [compound] [(] [\c!nleft=3,\c!nright=3,\c!type=2]                 % type=5,middle=(,left=(-,right=
79\definebreakpoint [compound] [)] [\c!nleft=3,\c!nright=3,\c!type=3]                 % type=5,middle=),left=,right=-)
80
81\let\installbreakpoint\definebreakpoint % for a while
82
83% \start \hsize 1.5cm \setbreakpoints[compound]
84%     \definebreakpoint [compound] [-] [nleft=3,nright=3,type=5,left=,right={-},middle={-}]
85%     \definebreakpoint [compound] [(] [nleft=3,nright=3,type=5,left=,right={(-},middle={(}]
86%     \definebreakpoint [compound] [)] [nleft=3,nright=3,type=5,left={-)},right=,middle={)}]
87%     composed-word\par composed(word)\par
88% \stop
89
90% \mainlanguage[czech]
91% \definebreakpoint [compound] [\number`-] [language=cs,nleft=3,nright=3,type=4]
92% \setbreakpoints[compound]
93% \start \hsize 1mm test-test \par \stop
94
95%D Maybe some day default:
96%
97% \setbreakpoints[compound]
98
99\protect \endinput
100
101