forked from Shuenhoy/modern-zju-thesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfakebold.typ
32 lines (27 loc) · 936 Bytes
/
fakebold.typ
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
// Orignal source: https://github.com/csimide/cuti
#let fakebold(base-weight: none, s, ..params) = {
set text(weight: base-weight) if base-weight != none
set text(..params) if params != ()
context {
set text(stroke: 0.02857 * 4 / 3 * text.size + text.fill)
s
}
}
#let regex-fakebold(reg-exp: ".", base-weight: none, s, ..params) = {
show regex(reg-exp): it => {
fakebold(base-weight: base-weight, it, ..params)
}
s
}
#let show-fakebold(reg-exp: ".", base-weight: none, s, ..params) = {
show text.where(weight: "bold").or(strong): it => {
regex-fakebold(reg-exp: reg-exp, base-weight: base-weight, it, ..params)
}
s
}
#let cn-fakebold(s, ..params) = {
regex-fakebold(reg-exp: "[\p{script=Han}!-・〇-〰—]+", base-weight: "regular", s, ..params)
}
#let show-cn-fakebold(s, ..params) = {
show-fakebold(reg-exp: "[\p{script=Han}!-・〇-〰—]+", base-weight: "regular", s, ..params)
}