Skip to content

Commit

Permalink
use OpenSans as fallback font on PRs from forks
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoow committed Oct 14, 2024
1 parent c437f75 commit 4ca49fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: Get Core Sans
uses: actions/checkout@v4
if: "!github.event.pull_request.head.repo.fork"
with:
fetch-depth: 0
repository: mainmatter/core-sans-a-fonts
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
path: core-sans-a-fonts
- name: Install Fonts
- name: Install Core Sans Font
if: "!github.event.pull_request.head.repo.fork"
run: |
sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/
sudo fc-cache -f -v
fc-list | grep "Core Sans"
- name: Use Fallback font for fork PRs
if: "github.event.pull_request.head.repo.fork"
run: |
sed -i 's/"BoldFont=CoreSansA65.ttf",//g' book/book.toml
sed -i 's/"ItalicFont=CoreSansA45It.ttf",//g' book/book.toml
sed -i 's/"BoldItalicFont=CoreSansA65It.ttf",//g' book/book.toml
sed -i 's/CoreSansA45.ttf/Open Sans:style=Regular/g' book/book.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install exercise plugin
run: cargo install --path helpers/mdbook-exercise-linker
Expand All @@ -35,8 +45,8 @@ jobs:
run: |
cargo install mdbook-pandoc --locked --version 0.7.1
sudo apt-get update
sudo apt-get install -y fonts-noto calibre pdftk
sudo apt-get install -y fonts-noto fonts-open-sans calibre pdftk
sudo fc-cache -f -v
export PANDOC_VERSION=3.3
curl -LsSf https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | tar zxf -
echo "$PWD/pandoc-${PANDOC_VERSION}/bin" >> $GITHUB_PATH
Expand Down
12 changes: 6 additions & 6 deletions book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ sansfontoptions = [
]
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
monofont = "Noto Sans Mono"
mainfontfallback = ["Noto Color Emoji:mode=harf"]
sansfontfallback = ["Noto Color Emoji:mode=harf"]
mainfontfallback = ["Open Sans"]
sansfontfallback = ["Open Sans"]
monofontfallback = [
"Noto Color Emoji:mode=harf",
]
Expand Down Expand Up @@ -90,8 +90,8 @@ sansfontoptions = [
]
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
monofont = "Noto Sans Mono"
mainfontfallback = ["Noto Color Emoji:mode=harf"]
sansfontfallback = ["Noto Color Emoji:mode=harf"]
mainfontfallback = ["Open Sans"]
sansfontfallback = ["Open Sans"]
monofontfallback = [
"Noto Color Emoji:mode=harf",
]
Expand Down Expand Up @@ -121,8 +121,8 @@ metadata-file = "metadata.yml"
[output.pandoc.profile.html.variables]
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
monofont = "Noto Sans Mono"
mainfontfallback = ["Noto Color Emoji:mode=harf"]
sansfontfallback = ["Noto Color Emoji:mode=harf"]
mainfontfallback = ["Open Sans"]
sansfontfallback = ["Open Sans"]
monofontfallback = [
"Noto Color Emoji:mode=harf",
]
Expand Down

0 comments on commit 4ca49fa

Please sign in to comment.