Skip to content

Commit

Permalink
🚶 store fonts locally
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Feb 27, 2023
1 parent bcc1274 commit d3bb898
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
10 changes: 4 additions & 6 deletions scripts/01_downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Downloads.download(
"cursor.zip",
)

_fonts_dir = joinpath(homedir(), ".local", "share", "fonts", "TeXGyre")
run(`mkdir -p $(_fonts_dir)`)
_fonts_dir = ".fonts"
isdir(_fonts_dir) || mkdir(_fonts_dir)

run(`unzip heros.zip`)
run(`unzip termes.zip`)
Expand All @@ -57,7 +57,6 @@ for _font in _fonts
mv(_font, joinpath(_fonts_dir, fname); force = true)
end

run(`fc-cache -vf`)
run(`rm heros.zip`)
run(`rm termes.zip`)
run(`rm termesmath.zip`)
Expand All @@ -75,16 +74,15 @@ Downloads.download(
run(`unzip JuliaMono.zip`)
run(`rm -r webfonts`)

_fonts_dir = joinpath(homedir(), ".local", "share", "fonts", "JuliaMono")
run(`mkdir -p $(_fonts_dir)`)
_fonts_dir = ".fonts"
isdir(_fonts_dir) || mkdir(_fonts_dir)

_fonts = filter!(f -> endswith(f, ".ttf"), filter!(isfile, readdir()))
for _font in _fonts
fname = last(splitpath(_font))
mv(_font, joinpath(_fonts_dir, fname); force = true)
end

run(`fc-cache -vf`)
run(`rm JuliaMono.zip`)

end
2 changes: 1 addition & 1 deletion scripts/04_run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _pandoc = `./pandoc-2.19.2/bin/pandoc`

@info "Build the preprint"
run(
`$(_pandoc) README.md -s -o dist/$(metadata["filename"])_preprint.pdf --pdf-engine ./tectonic $(_common_options) --template=.typesetter/templates/preprint.tex`,
`$(_pandoc) README.md -s -o dist/$(metadata["filename"])_preprint.pdf --pdf-engine tectonic $(_common_options) --template=.typesetter/templates/preprint.tex`,
)

@info "Build the draft"
Expand Down
18 changes: 11 additions & 7 deletions templates/_common.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{texgyretermes}[
Extension = .otf,
UprightFont = *-regular,
Path=.fonts/,
Extension=.otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]
\setmathfont{texgyretermes-math}[
Path=.fonts/,
Extension = .otf,
Scale=MatchLowercase,
]
\setsansfont{texgyreheros}[
Path=.fonts/,
Scale=MatchLowercase,
Extension = .otf,
UprightFont = *-regular,
Expand All @@ -25,13 +28,14 @@
BoldItalicFont = *-bolditalic,
]
\setmonofont{JuliaMono}[
Path=.fonts/,
Extension = .ttf,
Ligatures=NoCommon,
Scale=MatchLowercase,
Extension = .ttf,
UprightFont = *_Regular,
BoldFont = *_SemiBold,
ItalicFont = *_RegularItalic,
BoldItalicFont = *_SemiBoldItalic,
UprightFont = *-Regular,
BoldFont = *-SemiBold,
ItalicFont = *-RegularItalic,
BoldItalicFont = *-SemiBoldItalic,
Contextuals = Alternate,
CharacterVariant = 1,
]
Expand Down

0 comments on commit d3bb898

Please sign in to comment.