-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
lib.typ
85 lines (77 loc) · 2.05 KB
/
lib.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
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
/*
* Entry point for the package
*/
/* Packages */
#import "./cv.typ": *
#import "./letter.typ": *
#import "./utils/lang.typ": isNonLatin
#import "./utils/styles.typ": overwriteFonts
/* Layout */
#let cv(
metadata,
profilePhoto: image("./template/src/avatar.png"),
doc,
) = {
// Non Latin Logic
let lang = metadata.language
let fontList = latinFontList
let headerFont = latinHeaderFont
fontList = overwriteFonts(metadata, latinFontList, latinHeaderFont).regularFonts
headerFont = overwriteFonts(metadata, latinFontList, latinHeaderFont).headerFont
if isNonLatin(lang) {
let nonLatinFont = metadata.lang.non_latin.font
fontList.insert(2, nonLatinFont)
headerFont = nonLatinFont
}
// Page layout
set text(font: fontList, weight: "regular", size: 9pt)
set align(left)
set page(
paper: "a4",
margin: (left: 1.4cm, right: 1.4cm, top: 1cm, bottom: 1cm),
footer: _cvFooter(metadata),
)
_cvHeader(metadata, profilePhoto, headerFont, regularColors, awesomeColors)
doc
}
#let letter(
metadata,
doc,
myAddress: "Your Address Here",
recipientName: "Company Name Here",
recipientAddress: "Company Address Here",
date: datetime.today().display(),
subject: "Subject: Hey!",
signature: "",
) = {
// Non Latin Logic
let lang = metadata.language
let fontList = latinFontList
fontList = overwriteFonts(metadata, latinFontList, latinHeaderFont).regularFonts
if isNonLatin(lang) {
let nonLatinFont = metadata.lang.non_latin.font
fontList.insert(2, nonLatinFont)
}
// Page layout
set text(font: fontList, weight: "regular", size: 9pt)
set align(left)
set page(
paper: "a4",
margin: (left: 1.4cm, right: 1.4cm, top: 1cm, bottom: 1cm),
footer: _letterFooter(metadata),
)
set text(size: 12pt)
_letterHeader(
myAddress: myAddress,
recipientName: recipientName,
recipientAddress: recipientAddress,
date: date,
subject: subject,
metadata: metadata,
awesomeColors: awesomeColors,
)
doc
if signature != "" {
_letterSignature(signature)
}
}