From 8730a8458af385e31b860076f3c8798e0a8f72d1 Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Tue, 20 Aug 2024 15:48:55 +0200 Subject: [PATCH 01/10] use Core Sans font --- .github/workflows/ci.yml | 11 +++++++++++ book/book.toml | 28 ++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74683de..48d315d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,17 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + repository: mainmatter/core-sans-a-fonts + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + path: core-sans-a-fonts + - name: Install Fonts + run: | + sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/ + sudo fc-cache -f -v + fc-list | grep "Core Sans" - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Install exercise plugin run: cargo install --path helpers/mdbook-exercise-linker diff --git a/book/book.toml b/book/book.toml index c739aa6..7ad7bcc 100644 --- a/book/book.toml +++ b/book/book.toml @@ -33,8 +33,18 @@ metadata-file = "metadata.yml" [output.pandoc.profile.pdf.variables] # You can get these fonts here: https://fonts.google.com/selection?query=noto+color+ -mainfont = "Noto Serif" -sansfont = "Noto Sans" +mainfont = "CoreSansA45.ttf" +mainfontoptions = [ + "BoldFont=CoreSansA65.ttf", + "ItalicFont=CoreSansA45It.ttf", + "BoldItalicFont=CoreSansA65It.ttf" +] +sansfont = "CoreSansA45.ttf" +sansfontoptions = [ + "BoldFont=CoreSansA65.ttf", + "ItalicFont=CoreSansA45It.ttf", + "BoldItalicFont=CoreSansA65It.ttf" +] monofont = "Noto Sans Mono" mainfontfallback = ["Noto Color Emoji:mode=harf"] sansfontfallback = ["Noto Color Emoji:mode=harf"] @@ -63,8 +73,18 @@ pdf-engine = "lualatex" [output.pandoc.profile.paperback.variables] # You can get these fonts here: https://fonts.google.com/selection?query=noto+color+ -mainfont = "Noto Serif" -sansfont = "Noto Sans" +mainfont = "CoreSansA45.ttf" +mainfontoptions = [ + "BoldFont=CoreSansA65.ttf", + "ItalicFont=CoreSansA45It.ttf", + "BoldItalicFont=CoreSansA65It.ttf" +] +sansfont = "CoreSansA45.ttf" +sansfontoptions = [ + "BoldFont=CoreSansA65.ttf", + "ItalicFont=CoreSansA45It.ttf", + "BoldItalicFont=CoreSansA65It.ttf" +] monofont = "Noto Sans Mono" mainfontfallback = ["Noto Color Emoji:mode=harf"] sansfontfallback = ["Noto Color Emoji:mode=harf"] From d269320825f186d30614c55b166c36ffec9c704f Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Tue, 20 Aug 2024 16:54:53 +0200 Subject: [PATCH 02/10] set link and url styles --- book/book.toml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/book/book.toml b/book/book.toml index 7ad7bcc..ae209cb 100644 --- a/book/book.toml +++ b/book/book.toml @@ -37,13 +37,13 @@ mainfont = "CoreSansA45.ttf" mainfontoptions = [ "BoldFont=CoreSansA65.ttf", "ItalicFont=CoreSansA45It.ttf", - "BoldItalicFont=CoreSansA65It.ttf" + "BoldItalicFont=CoreSansA65It.ttf", ] sansfont = "CoreSansA45.ttf" sansfontoptions = [ "BoldFont=CoreSansA65.ttf", "ItalicFont=CoreSansA45It.ttf", - "BoldItalicFont=CoreSansA65It.ttf" + "BoldItalicFont=CoreSansA65It.ttf", ] monofont = "Noto Sans Mono" mainfontfallback = ["Noto Color Emoji:mode=harf"] @@ -51,13 +51,16 @@ sansfontfallback = ["Noto Color Emoji:mode=harf"] monofontfallback = [ "Noto Color Emoji:mode=harf", ] -linkcolor = "blue" -urlcolor = "blue" +monobackgroundcolor = "\\color[HTML]{e7e7e7}" +linkcolor = "Links" +urlcolor = "Links" +linkstyle = "bold" urlstyle = "rm" documentclass = "book" fontsize = "11pt" geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.4cm,right=2.4cm" header-includes = [ + "\\definecolor{Links}{HTML}{6200EE}", # Reduce font size of code blocks "\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}", ] @@ -77,13 +80,13 @@ mainfont = "CoreSansA45.ttf" mainfontoptions = [ "BoldFont=CoreSansA65.ttf", "ItalicFont=CoreSansA45It.ttf", - "BoldItalicFont=CoreSansA65It.ttf" + "BoldItalicFont=CoreSansA65It.ttf", ] sansfont = "CoreSansA45.ttf" sansfontoptions = [ "BoldFont=CoreSansA65.ttf", "ItalicFont=CoreSansA45It.ttf", - "BoldItalicFont=CoreSansA65It.ttf" + "BoldItalicFont=CoreSansA65It.ttf", ] monofont = "Noto Sans Mono" mainfontfallback = ["Noto Color Emoji:mode=harf"] From 1b050774e76aeed34c0361829d660f8e8a17045f Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Tue, 20 Aug 2024 17:37:33 +0200 Subject: [PATCH 03/10] custom syntax highlighting --- book/book.toml | 2 +- book/custom.theme | 211 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 book/custom.theme diff --git a/book/book.toml b/book/book.toml index ae209cb..c6461ad 100644 --- a/book/book.toml +++ b/book/book.toml @@ -51,7 +51,6 @@ sansfontfallback = ["Noto Color Emoji:mode=harf"] monofontfallback = [ "Noto Color Emoji:mode=harf", ] -monobackgroundcolor = "\\color[HTML]{e7e7e7}" linkcolor = "Links" urlcolor = "Links" linkstyle = "bold" @@ -64,6 +63,7 @@ header-includes = [ # Reduce font size of code blocks "\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}", ] +highlight-style = "book/custom.theme" [output.pandoc.profile.paperback] output-file = "100-exercises-to-learn-rust.pdf" diff --git a/book/custom.theme b/book/custom.theme new file mode 100644 index 0000000..82d9692 --- /dev/null +++ b/book/custom.theme @@ -0,0 +1,211 @@ +{ + "text-color": "#c9d1d9", + "background-color": "#343942", + "line-number-color": null, + "line-number-background-color": null, + "text-styles": { + "Alert": { + "text-color": "#ff0000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Annotation": { + "text-color": "#8b949e", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Attribute": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BaseN": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BuiltIn": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Char": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Comment": { + "text-color": "#8b949e", + "background-color": null, + "bold": false, + "italic": true, + "underline": false + }, + "CommentVar": { + "text-color": "#8b949e", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Constant": { + "text-color": "#79c0ff", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "ControlFlow": { + "text-color": "#03DAC5", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "DataType": { + "text-color": "#8b949e", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "DecVal": { + "text-color": "#79c0ff", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Documentation": { + "text-color": "#8b949e", + "background-color": null, + "bold": false, + "italic": true, + "underline": false + }, + "Error": { + "text-color": "#ff0000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Extension": { + "text-color": null, + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Float": { + "text-color": "#79c0ff", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Function": { + "text-color": "#d2a8ff", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Import": { + "text-color": "#8b949e", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Information": { + "text-color": "#8b949e", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Keyword": { + "text-color": "#03DAC5", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Operator": { + "text-color": "#03DAC5", + "background-color": "#161b22", + "bold": false, + "italic": false, + "underline": false + }, + "Other": { + "text-color": "#007020", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Preprocessor": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialChar": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialString": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "String": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Variable": { + "text-color": "#a8daff", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "VerbatimString": { + "text-color": "#03DAC5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Warning": { + "text-color": "#60a0b0", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + } + } +} From 982a8f07893bbe10a04c0cdecf9043b83e1c7b1e Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Tue, 20 Aug 2024 18:11:31 +0200 Subject: [PATCH 04/10] copy config to paperback --- book/book.toml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/book/book.toml b/book/book.toml index c6461ad..244f106 100644 --- a/book/book.toml +++ b/book/book.toml @@ -53,7 +53,6 @@ monofontfallback = [ ] linkcolor = "Links" urlcolor = "Links" -linkstyle = "bold" urlstyle = "rm" documentclass = "book" fontsize = "11pt" @@ -63,7 +62,6 @@ header-includes = [ # Reduce font size of code blocks "\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}", ] -highlight-style = "book/custom.theme" [output.pandoc.profile.paperback] output-file = "100-exercises-to-learn-rust.pdf" @@ -94,11 +92,12 @@ sansfontfallback = ["Noto Color Emoji:mode=harf"] monofontfallback = [ "Noto Color Emoji:mode=harf", ] +linkcolor = "Links" +urlcolor = "Links" urlstyle = "rm" -documentclass = "book" -fontsize = "11pt" geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.8cm,right=2.5cm" header-includes = [ + "\\definecolor{Links}{HTML}{6200EE}", # Reduce font size of code blocks "\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}", ] @@ -116,14 +115,24 @@ metadata-file = "metadata.yml" [output.pandoc.profile.html.variables] # You can get these fonts here: https://fonts.google.com/selection?query=noto+color+ -mainfont = "Noto Serif" -sansfont = "Noto Sans" +mainfont = "CoreSansA45.ttf" +mainfontoptions = [ + "BoldFont=CoreSansA65.ttf", + "ItalicFont=CoreSansA45It.ttf", + "BoldItalicFont=CoreSansA65It.ttf", +] +sansfont = "CoreSansA45.ttf" +sansfontoptions = [ + "BoldFont=CoreSansA65.ttf", + "ItalicFont=CoreSansA45It.ttf", + "BoldItalicFont=CoreSansA65It.ttf", +] monofont = "Noto Sans Mono" mainfontfallback = ["Noto Color Emoji:mode=harf"] sansfontfallback = ["Noto Color Emoji:mode=harf"] monofontfallback = [ "Noto Color Emoji:mode=harf", ] -linkcolor = "blue" -urlcolor = "blue" +linkcolor = "Links" +urlcolor = "Links" urlstyle = "rm" From 52c21a241d56a74991a809075df68df3fd2d43bf Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Thu, 22 Aug 2024 15:22:03 +0200 Subject: [PATCH 05/10] add lost settings for print version back in --- book/book.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/book.toml b/book/book.toml index 244f106..18d74b1 100644 --- a/book/book.toml +++ b/book/book.toml @@ -95,6 +95,8 @@ monofontfallback = [ linkcolor = "Links" urlcolor = "Links" urlstyle = "rm" +documentclass = "book" +fontsize = "11pt" geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.8cm,right=2.5cm" header-includes = [ "\\definecolor{Links}{HTML}{6200EE}", From cab4de6433b4f1128dded569feb85e50c55e0b62 Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Thu, 22 Aug 2024 15:25:58 +0200 Subject: [PATCH 06/10] remove background color on operators --- book/custom.theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/custom.theme b/book/custom.theme index 82d9692..64482db 100644 --- a/book/custom.theme +++ b/book/custom.theme @@ -146,7 +146,7 @@ }, "Operator": { "text-color": "#03DAC5", - "background-color": "#161b22", + "background-color": null, "bold": false, "italic": false, "underline": false From 297d78d7504ce427da8c5121309f6bb7c4613f7b Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Thu, 22 Aug 2024 15:38:18 +0200 Subject: [PATCH 07/10] actually use custom highlighting theme --- book/book.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/book.toml b/book/book.toml index 18d74b1..8e771b5 100644 --- a/book/book.toml +++ b/book/book.toml @@ -25,7 +25,7 @@ hosted-html = "https://rust-exercises.com/100-exercises/" [output.pandoc.profile.pdf] # options to pass to Pandoc (see https://pandoc.org/MANUAL.html) output-file = "100-exercises-to-learn-rust.pdf" to = "latex" -highlight-style = "tango" +highlight-style = "./custom.theme" # We use `lualatext` because, right now, it's the only engine # that supports fallback fonts, which we need for emojis. pdf-engine = "lualatex" From 6bdcf19f5fa5dc74ea561f95b403c1818a7e1b54 Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Thu, 22 Aug 2024 15:38:27 +0200 Subject: [PATCH 08/10] use less teal for sh theme --- book/custom.theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/custom.theme b/book/custom.theme index 64482db..b839db3 100644 --- a/book/custom.theme +++ b/book/custom.theme @@ -26,7 +26,7 @@ "underline": false }, "BaseN": { - "text-color": "#03DAC5", + "text-color": "#a5d6ff", "background-color": null, "bold": false, "italic": false, @@ -40,7 +40,7 @@ "underline": false }, "Char": { - "text-color": "#03DAC5", + "text-color": "#a5d6ff", "background-color": null, "bold": false, "italic": false, @@ -180,7 +180,7 @@ "underline": false }, "String": { - "text-color": "#03DAC5", + "text-color": "#a5d6ff", "background-color": null, "bold": false, "italic": false, @@ -194,7 +194,7 @@ "underline": false }, "VerbatimString": { - "text-color": "#03DAC5", + "text-color": "#a5d6ff", "background-color": null, "bold": false, "italic": false, From 681903a853c89c6bef11b7800f471f30c21f3e52 Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Tue, 27 Aug 2024 09:13:38 +0200 Subject: [PATCH 09/10] make fontsize 1pt smaller --- book/book.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/book.toml b/book/book.toml index 8e771b5..990213c 100644 --- a/book/book.toml +++ b/book/book.toml @@ -55,7 +55,7 @@ linkcolor = "Links" urlcolor = "Links" urlstyle = "rm" documentclass = "book" -fontsize = "11pt" +fontsize = "10pt" geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.4cm,right=2.4cm" header-includes = [ "\\definecolor{Links}{HTML}{6200EE}", @@ -96,7 +96,7 @@ linkcolor = "Links" urlcolor = "Links" urlstyle = "rm" documentclass = "book" -fontsize = "11pt" +fontsize = "10pt" geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.8cm,right=2.5cm" header-includes = [ "\\definecolor{Links}{HTML}{6200EE}", From 0ca42ba058543998b61aa00a131a1d2f88c37cb0 Mon Sep 17 00:00:00 2001 From: Marco Otte-Witte Date: Tue, 27 Aug 2024 09:14:20 +0200 Subject: [PATCH 10/10] move comment to meaningful place --- book/book.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/book.toml b/book/book.toml index 990213c..12eecb2 100644 --- a/book/book.toml +++ b/book/book.toml @@ -32,7 +32,6 @@ pdf-engine = "lualatex" metadata-file = "metadata.yml" [output.pandoc.profile.pdf.variables] -# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+ mainfont = "CoreSansA45.ttf" mainfontoptions = [ "BoldFont=CoreSansA65.ttf", @@ -45,6 +44,7 @@ sansfontoptions = [ "ItalicFont=CoreSansA45It.ttf", "BoldItalicFont=CoreSansA65It.ttf", ] +# 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"] @@ -73,7 +73,6 @@ metadata-file = "metadata.yml" pdf-engine = "lualatex" [output.pandoc.profile.paperback.variables] -# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+ mainfont = "CoreSansA45.ttf" mainfontoptions = [ "BoldFont=CoreSansA65.ttf", @@ -86,6 +85,7 @@ sansfontoptions = [ "ItalicFont=CoreSansA45It.ttf", "BoldItalicFont=CoreSansA65It.ttf", ] +# 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"] @@ -116,7 +116,6 @@ standalone = true metadata-file = "metadata.yml" [output.pandoc.profile.html.variables] -# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+ mainfont = "CoreSansA45.ttf" mainfontoptions = [ "BoldFont=CoreSansA65.ttf", @@ -129,6 +128,7 @@ sansfontoptions = [ "ItalicFont=CoreSansA45It.ttf", "BoldItalicFont=CoreSansA65It.ttf", ] +# 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"]