typo-brk.mkxl /size: 3794 b    last modification: 2023-12-21 09:44
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}{autosuffix}
25
26\definesystemattribute[breakpoint][public,global]
27
28% see below: \exhyphenchar \minusone % we use a different order than base tex, so we really need this
29
30% \definebreakpoints [test]
31%
32% \definebreakpoint [test][:][nleft=3,nright=3,type=1]
33% \definebreakpoint [test][/][nleft=3,nright=3,type=1]
34%
35% {\setbreakpoints[test]\hsize1mm\nohyphens x boundary:boundary/boundary\par}
36% {\setbreakpoints[test]\hsize1mm x boundary:boundary/boundary\par} % still hyphenated
37
38\permanent\tolerant\protected\def\definebreakpoints[#1]%
39  {\clf_definebreakpoints{#1}} % todo: public implementor
40
41\permanent\tolerant\protected\def\definebreakpoint[#1]#*[#2]#*[#S#3]% name char settings
42  {\begingroup
43   \getdummyparameters
44     [\c!type=\plusone,\c!nleft=\plusthree,\c!nright=\plusthree,%
45      \s!language=,\c!left=,\c!right=,\c!middle=,\c!range=\v!no,%
46      #3]%
47   \clf_definebreakpoint
48     {#1}%
49     {#2}%
50     {\reallanguagetag{\directdummyparameter\s!language}}%
51     {% maybe deal with #3 at the lua end
52          type \directdummyparameter\c!type
53         nleft \directdummyparameter\c!nleft
54        nright \directdummyparameter\c!nright
55         right {\directdummyparameter\c!right}%
56          left {\directdummyparameter\c!left}%
57        middle {\directdummyparameter\c!middle}%
58        range  {\directdummyparameter\c!range}%
59     }%
60   \relax
61   \endgroup}
62
63\permanent\protected\def\setbreakpoints[#1]%
64  {%\exhyphenchar\minusone % we now use collapsing so ...
65   \clf_setbreakpoints{#1}}
66
67\permanent\protected\def\resetbreakpoints
68  {%\exhyphenchar\hyphenasciicode % 2020.03.05 / we now use collapsing so ...
69   \c_attr_breakpoint\attributeunsetvalue}
70
71\definebreakpoints[compound]
72
73% 1: simple break
74% 6: simple break but skip same
75
76\definebreakpoint [compound] [+] [\c!nleft=3,\c!nright=3,\c!type=1]                 % middle=+,left=,right=
77%definebreakpoint [compound] [-] [\c!nleft=3,\c!nright=3,\c!type=1,\c!range=\v!yes] % middle=+,left=,right=
78\definebreakpoint [compound] [-] [\c!nleft=3,\c!nright=3,\c!type=6,\c!range=\v!yes] % middle=+,left=,right=
79\definebreakpoint [compound] [/] [\c!nleft=3,\c!nright=3,\c!type=1]                 % middle=+,left=,right=
80\definebreakpoint [compound] [(] [\c!nleft=3,\c!nright=3,\c!type=2]                 % type=5,middle=(,left=(-,right=
81\definebreakpoint [compound] [)] [\c!nleft=3,\c!nright=3,\c!type=3]                 % type=5,middle=),left=,right=-)
82
83\aliased\let\installbreakpoint\definebreakpoint % for a while
84
85% \start \hsize 1.5cm \setbreakpoints[compound]
86%     \definebreakpoint [compound] [-] [nleft=3,nright=3,type=5,left=,right={-},middle={-}]
87%     \definebreakpoint [compound] [(] [nleft=3,nright=3,type=5,left=,right={(-},middle={(}]
88%     \definebreakpoint [compound] [)] [nleft=3,nright=3,type=5,left={-)},right=,middle={)}]
89%     composed-word\par composed(word)\par
90% \stop
91
92% \mainlanguage[czech]
93% \definebreakpoint [compound] [-] [language=cs,nleft=3,nright=3,type=4]
94% \setbreakpoints[compound]
95% \start \hsize 1mm test-test \par \stop
96
97%D Maybe some day default:
98%
99% \setbreakpoints[compound]
100
101\protect \endinput
102
103