Skip to content

Commit b59b8c3

Browse files
authored
start to customize the fonts of the typst template (#254)
1 parent 3a88312 commit b59b8c3

File tree

3 files changed

+44
-79
lines changed

3 files changed

+44
-79
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
*.docx
55
*.html
66
.cache/*
7+
8+
# Do include files in the template directory
9+
!/template/*

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ COPY --from=build-fonts \
225225
/usr/share/fonts/truetype/msttcorefonts/Courier* \
226226
/usr/share/fonts/TTF/ARIAL* \
227227
/usr/share/fonts/OTF/Libertinus* \
228-
/usr/share/fonts/truetype/noto/NotoSansMono* \
228+
/usr/share/fonts/truetype/noto/NotoSans-* \
229+
/usr/share/fonts/truetype/noto/NotoSansMono-* \
230+
/usr/share/fonts/truetype/noto/NotoSansMath-* \
231+
/usr/share/fonts/truetype/noto/NotoSerif-* \
229232
/usr/share/fonts/
230233
# Refresh the font cache.
231234
RUN fc-cache -f

template/tcg.typ

Lines changed: 37 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@
44
// pandoc -D typst
55
//
66

7+
//
8+
// TODO: Title page
9+
//
10+
11+
//
12+
// Font settings
13+
//
14+
// Normal text
15+
#set text(
16+
font: "Noto Sans",
17+
size: 9pt,
18+
)
19+
// Math
20+
#show math.equation: set text(
21+
font: "Noto Sans Math",
22+
size: 9pt,
23+
)
24+
// Code
25+
#show raw: set text(
26+
font: "Noto Sans Mono",
27+
size: 9pt,
28+
)
29+
// Headings
30+
#set heading(numbering: "1.1")
31+
#show heading: it => block()[
32+
#let size = 16pt - it.depth*2pt
33+
#if size < 10pt { size = 10pt }
34+
#set align(center)
35+
#set text(
36+
font: "Noto Sans",
37+
size: size,
38+
weight: "semibold")
39+
#it
40+
]
41+
742
#let horizontalrule = line(start: (25%,0%), end: (75%,0%))
843

944
#show terms: it => {
@@ -22,88 +57,12 @@
2257

2358
#show figure.where(
2459
kind: table
25-
): set figure.caption(position: $if(table-caption-position)$$table-caption-position$$else$top$endif$)
60+
): set figure.caption(position: bottom)
2661

2762
#show figure.where(
2863
kind: image
29-
): set figure.caption(position: $if(figure-caption-position)$$figure-caption-position$$else$bottom$endif$)
30-
31-
$if(template)$
32-
#import "$template$": conf
33-
$else$
34-
$template.typst()$
35-
$endif$
36-
37-
$if(smart)$
38-
$else$
39-
#set smartquote(enabled: false)
40-
41-
$endif$
42-
$for(header-includes)$
43-
$header-includes$
44-
45-
$endfor$
46-
#show: doc => conf(
47-
$if(title)$
48-
title: [$title$],
49-
$endif$
50-
$if(subtitle)$
51-
subtitle: [$subtitle$],
52-
$endif$
53-
$if(author)$
54-
authors: (
55-
$for(author)$
56-
$if(author.name)$
57-
( name: [$author.name$],
58-
affiliation: [$author.affiliation$],
59-
email: [$author.email$] ),
60-
$else$
61-
( name: [$author$],
62-
affiliation: "",
63-
email: "" ),
64-
$endif$
65-
$endfor$
66-
),
67-
$endif$
68-
$if(keywords)$
69-
keywords: ($for(keywords)$$keyword$$sep$,$endfor$),
70-
$endif$
71-
$if(date)$
72-
date: [$date$],
73-
$endif$
74-
$if(lang)$
75-
lang: "$lang$",
76-
$endif$
77-
$if(region)$
78-
region: "$region$",
79-
$endif$
80-
$if(abstract)$
81-
abstract: [$abstract$],
82-
$endif$
83-
$if(margin)$
84-
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
85-
$endif$
86-
$if(papersize)$
87-
paper: "$papersize$",
88-
$endif$
89-
$if(mainfont)$
90-
font: ("$mainfont$",),
91-
$endif$
92-
$if(fontsize)$
93-
fontsize: $fontsize$,
94-
$endif$
95-
$if(section-numbering)$
96-
sectionnumbering: "$section-numbering$",
97-
$endif$
98-
pagenumbering: $if(page-numbering)$"$page-numbering$"$else$none$endif$,
99-
cols: $if(columns)$$columns$$else$1$endif$,
100-
doc,
101-
)
64+
): set figure.caption(position: bottom)
10265

103-
$for(include-before)$
104-
$include-before$
105-
106-
$endfor$
10766
$if(toc)$
10867
#outline(
10968
title: auto,

0 commit comments

Comments
 (0)