-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sap
207 lines (165 loc) · 7.41 KB
/
test.sap
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# test.sap
import "std";
import "std/table.sap";
let serif = builtin::find_font_family(["XCharter", "Times New Roman", "serif"]);
# let sans = builtin::find_font_family(["Helvetica"]);
# sans!.regular.adjust_glyph_spacing({ match: ["1.4"], adjust: [0.0, -0.04, 0.0] });
# sans!.regular.adjust_glyph_spacing({ match: ["1.2", "1.3", "1.5", "1.6", "1.7", "1.8", "1.9"], adjust: [0.0, -0.07, 0.0] });
# sans!.regular.adjust_glyph_spacing({ match: ["2.1", "3.1", "4.1", "5.1", "6.1", "8.1", "9.1", "0.1"], adjust: [0.0, +0.05, 0.0] });
\start_document({
serif_font_family: *serif,
# sans_font_family: *sans,
# paper_size: std::paper_size::A4,
margins: { left: 2cm, right: 2cm, top: 2cm, bottom: 2cm },
default_style: {
# font_size: 11pt,
line_spacing: 1.0,
# sentence_space_stretch: 1.3,
paragraph_spacing: 0em,
},
});
\script::{
# using std;
using builtin;
# enum Hello
# {
# a;
# b;
# c;
# };
# fn cpp() -> Inline
# {
# let c = \{C}.set_width(0.56em);
# var p1 = bold1(\{+}).apply_style({ font_size: 0.875em, });
# var p2 = bold1(\{+}).apply_style({ font_size: 0.875em, });
# p1.set_width(0.6em);
# p1.raise(0.05em);
# p2.raise(0.05em);
# return make_span(glue: true, *c, *p1, *p2);
# }
# fn kekw() -> Inline
# {
# var k: Hello = .a;
# k = .b;
# k = Hello::c;
# return italic1(make_span(\{asdf}, cpp()));
# }
# union AAA
# {
# Bar(a: int);
# Foo(a: int);
# };
# fn asdf()
# {
# # csdf(.Foo);
# var p: AAA = .Bar(a: 10);
# # cast(p, .Line).a = 69;
# # println(f"{cast(p, .Line).a}");
# if(let .Foo(&mut a: x) = p)
# {
# x! = 30;
# println(f"hello!: {cast(p, .Bar).a}");
# }
# else
# {
# println("oh no");
# }
# }
# fn bsdf() -> ?Inline
# {
# let a: ?int = 500;
# let b: ?int = null;
# if(let aa = a) println(f"a has a value: {a}");
# else println(f"a has no value");
# if(let bb = b) println(f"b has a value: {b}");
# else println(f"b has no value");
# asdf();
# return null;
# }
fn haha() -> ?Block
{
return make_path(style: {
stroke_colour: Colour {type: .RGB, rgb: {r: 1, g: 0, b: 0}},
line_width: 0.2cm,
# }, .Move(pos: {x:0cm, y:5cm}), .Line(pos: {x:0cm, y:0cm}), .Line(pos: {x:5cm, y:0cm}));
}, .Move(pos: {x:0cm, y:0cm}), .CubicBezier(c1: {x:6cm, y:3cm}, c2: {x:6cm, y:6cm}, end: {x:0cm, y:9cm}),
.CubicBezier(c1: {x:-6cm, y:12cm}, c2: {x:-6cm, y:15cm}, end: {x:0cm, y:18cm}));
}
fn omegalul(ctx: &void) -> Block
{
return make_paragraph(make_text("aaaaaaa"));
}
fn help() -> Block
{
return set_border_style(apply_style({horz_alignment: .Centred}, make_vbox(
# \line { Goodbye World },
\line { Hello World },
# \line { Goodbye World },
# \line { Goodbye World },
# \line { Goodbye World },
# \line { Goodbye World },
# \line { Goodbye World },
\line { Goodbye World },
\para {
It is a long established fact that a reader will be distracted by the readable content of a page when looking
at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,
as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum'
will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like).
}
)), BorderStyle {
top: { line_width: 0.2cm, stroke_colour: std::rgb(1, 0, 0), cap_style: .Round },
left: { line_width: 1cm, stroke_colour: std::rgb(0, 1, 0), cap_style: .Round },
right: { line_width: 1cm, stroke_colour: std::rgb(0, 0, 1), cap_style: .Round },
bottom: { line_width: 0.4cm, stroke_colour: std::rgb(1, 0, 1), cap_style: .Round },
top_padding: 5mm,
left_padding: 5mm,
right_padding: 5mm,
bottom_padding: 5mm,
});
}
}
# \std::disable_page_numbering();
# hello \cpp() there \kekw() \bsdf()
# aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa
It is a long established fact that a reader will be distracted by the readable content of a page when looking
at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,
as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum'
will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like).
It is a long established fact that a reader will be distracted by the readable content of a page when looking
at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,
as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum'
will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like).
It is a long established fact that a reader will be distracted by the readable content of a page when looking
at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,
as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum'
will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like).
It is a long established fact that a reader will be distracted by the readable content of a page when looking
at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,
as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum'
will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like).
It is a long established fact that a reader will be distracted by the readable content of a page when looking
at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,
as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum'
will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like).
# \vspace(-1em);
# \std::table({cols: 4},
# \para{AA1}, \para{BB1}, \para{CC1}, \para{DD1},
# \para{AA2}, \para{BB2}, \para{CC2}, \para{DD2},
# \para{AA3}, \para{BB3}, \para{CC3}, \para{DD3},
# \para{AA4}, \para{BB4}, \para{CC4}, \para{DD4});
# \builtin::make_deferred_block(null, omegalul);
# \haha()
\help()
hellohellohellohellohellohellohellohellohellohellohellohellohellohello