Skip to content

Commit 4ca49fa

Browse files
committed
use OpenSans as fallback font on PRs from forks
1 parent c437f75 commit 4ca49fa

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,27 @@ jobs:
1515
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18-
- uses: actions/checkout@v4
18+
- name: Get Core Sans
19+
uses: actions/checkout@v4
20+
if: "!github.event.pull_request.head.repo.fork"
1921
with:
2022
fetch-depth: 0
2123
repository: mainmatter/core-sans-a-fonts
2224
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
2325
path: core-sans-a-fonts
24-
- name: Install Fonts
26+
- name: Install Core Sans Font
27+
if: "!github.event.pull_request.head.repo.fork"
2528
run: |
2629
sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/
2730
sudo fc-cache -f -v
2831
fc-list | grep "Core Sans"
32+
- name: Use Fallback font for fork PRs
33+
if: "github.event.pull_request.head.repo.fork"
34+
run: |
35+
sed -i 's/"BoldFont=CoreSansA65.ttf",//g' book/book.toml
36+
sed -i 's/"ItalicFont=CoreSansA45It.ttf",//g' book/book.toml
37+
sed -i 's/"BoldItalicFont=CoreSansA65It.ttf",//g' book/book.toml
38+
sed -i 's/CoreSansA45.ttf/Open Sans:style=Regular/g' book/book.toml
2939
- uses: actions-rust-lang/setup-rust-toolchain@v1
3040
- name: Install exercise plugin
3141
run: cargo install --path helpers/mdbook-exercise-linker
@@ -35,8 +45,8 @@ jobs:
3545
run: |
3646
cargo install mdbook-pandoc --locked --version 0.7.1
3747
sudo apt-get update
38-
sudo apt-get install -y fonts-noto calibre pdftk
39-
48+
sudo apt-get install -y fonts-noto fonts-open-sans calibre pdftk
49+
sudo fc-cache -f -v
4050
export PANDOC_VERSION=3.3
4151
curl -LsSf https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | tar zxf -
4252
echo "$PWD/pandoc-${PANDOC_VERSION}/bin" >> $GITHUB_PATH

book/book.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ sansfontoptions = [
4949
]
5050
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
5151
monofont = "Noto Sans Mono"
52-
mainfontfallback = ["Noto Color Emoji:mode=harf"]
53-
sansfontfallback = ["Noto Color Emoji:mode=harf"]
52+
mainfontfallback = ["Open Sans"]
53+
sansfontfallback = ["Open Sans"]
5454
monofontfallback = [
5555
"Noto Color Emoji:mode=harf",
5656
]
@@ -90,8 +90,8 @@ sansfontoptions = [
9090
]
9191
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
9292
monofont = "Noto Sans Mono"
93-
mainfontfallback = ["Noto Color Emoji:mode=harf"]
94-
sansfontfallback = ["Noto Color Emoji:mode=harf"]
93+
mainfontfallback = ["Open Sans"]
94+
sansfontfallback = ["Open Sans"]
9595
monofontfallback = [
9696
"Noto Color Emoji:mode=harf",
9797
]
@@ -121,8 +121,8 @@ metadata-file = "metadata.yml"
121121
[output.pandoc.profile.html.variables]
122122
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
123123
monofont = "Noto Sans Mono"
124-
mainfontfallback = ["Noto Color Emoji:mode=harf"]
125-
sansfontfallback = ["Noto Color Emoji:mode=harf"]
124+
mainfontfallback = ["Open Sans"]
125+
sansfontfallback = ["Open Sans"]
126126
monofontfallback = [
127127
"Noto Color Emoji:mode=harf",
128128
]

0 commit comments

Comments
 (0)