Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Add option to disable Google Fonts and load fonts locally #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 111 additions & 2 deletions layouts/partials/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,116 @@ kbd {

/* Fonts */

{{ if not .Site.Params.disablefancyfonts }}
.wf-raleway-n4-active body,
{{ if not .Site.Params.disablefancyfonts }}

{{ if .Site.Params.disablegooglefonts }}
@font-face {
font-family: 'Raleway';
src: url('{{ .Site.BaseURL }}fonts/Raleway-Regular.ttf');
font-style: normal;
font-weight: 400;
}

@font-face {
font-family: 'Raleway';
src: url('{{ .Site.BaseURL }}fonts/Raleway-Italic.ttf');
font-style: italic;
font-weight: 400;
}

@font-face {
font-family: 'Raleway';
src: url('{{ .Site.BaseURL }}fonts/Raleway-SemiBold.ttf');
font-style: normal;
font-weight: 600;
}

@font-face {
font-family: 'Raleway';
src: url('{{ .Site.BaseURL }}fonts/Raleway-SemiBoldItalic.ttf');
font-style: italic;
font-weight: 600;
}

@font-face {
font-family: 'Raleway';
src: url('{{ .Site.BaseURL }}fonts/Raleway-Bold.ttf');
font-style: normal;
font-weight: 700;
}

@font-face {
font-family: 'Raleway';
src: url('{{ .Site.BaseURL }}fonts/Raleway-BoldItalic.ttf');
font-style: italic;
font-weight: 700;
}

@font-face {
font-family: 'Merriweather';
src: url('{{ .Site.BaseURL }}fonts/Merriweather-Light.ttf');
font-style: normal;
font-weight: 300;
}

@font-face {
font-family: 'Merriweather';
src: url('{{ .Site.BaseURL }}fonts/Merriweather-LightItalic.ttf');
font-style: italic;
font-weight: 300;
}

@font-face {
font-family: 'Merriweather';
src: url('{{ .Site.BaseURL }}fonts/Merriweather-Bold.ttf');
font-style: normal;
font-weight: 700;
}

@font-face {
font-family: 'Merriweather';
src: url('{{ .Site.BaseURL }}fonts/Merriweather-BoldItalic.ttf');
font-style: italic;
font-weight: 700;
}

@font-face {
font-family: 'Ubuntu Mono';
src: url('{{ .Site.BaseURL }}fonts/UbuntuMono-Regular.ttf');
font-style: normal;
font-weight: 400;
}

@font-face {
font-family: 'Ubuntu Mono';
src: url('{{ .Site.BaseURL }}fonts/UbuntuMono-Bold.ttf');
font-style: normal;
font-weight: 700;
}

body,
div.header nav ul a,
div.main .content .page-heading,
div.main .container.f04 .content .num,
div.main .content .markdown h1,
div.main .content .markdown h2,
div.main .content .markdown h3,
div.main .content .markdown h4,
div.main .content .markdown h5,
div.main .content .markdown h6 {
font-family: 'Raleway';
}

div.main .content .markdown {
font-family: 'Merriweather';
}

div.main .content .markdown code,
div.main .content .markdown pre {
font-family: 'Ubuntu Mono';
}
{{ else }}
.wf-raleway-n4-active body,
.wf-raleway-n4-active div.header nav ul a,
.wf-raleway-n7-active div.main .content .page-heading,
.wf-raleway-n2-active div.main .container.f04 .content .num,
Expand All @@ -769,4 +877,5 @@ kbd {
.wf-ubuntu-mono-n4-active div.main .content .markdown pre {
font-family: 'Ubuntu Mono';
}
{{ end }}
{{ end }}
2 changes: 1 addition & 1 deletion layouts/partials/footer_scripts.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if not .Site.Params.disablefancyfonts }}
{{ if (and (not .Site.Params.disablefancyfonts) (not .Site.Params.disablegooglefonts)) }}
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script>
<script>
WebFont.load({
Expand Down
2 changes: 2 additions & 0 deletions layouts/partials/head_includes.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
{{ partial "css/min769px.css" . | safeCSS }}
</style>

{{ if (and (not .Site.Params.disablefancyfonts) (not .Site.Params.disablegooglefonts)) }}
<noscript>
<link href="https://fonts.googleapis.com/css?family=Raleway:400,600,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Merriweather:300,300i,700,700i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700" rel="stylesheet">
</noscript>
{{ end }}

{{ if .Site.Params.highlightjs }}
<style type="text/css" media="screen">
Expand Down
Binary file added static/fonts/Merriweather-Bold.ttf
Binary file not shown.
Binary file added static/fonts/Merriweather-BoldItalic.ttf
Binary file not shown.
Binary file added static/fonts/Merriweather-Light.ttf
Binary file not shown.
Binary file added static/fonts/Merriweather-LightItalic.ttf
Binary file not shown.
Binary file added static/fonts/Raleway-Bold.ttf
Binary file not shown.
Binary file added static/fonts/Raleway-BoldItalic.ttf
Binary file not shown.
Binary file added static/fonts/Raleway-Italic.ttf
Binary file not shown.
Binary file added static/fonts/Raleway-Regular.ttf
Binary file not shown.
Binary file added static/fonts/Raleway-SemiBold.ttf
Binary file not shown.
Binary file added static/fonts/Raleway-SemiBoldItalic.ttf
Binary file not shown.
Binary file added static/fonts/UbuntuMono-Bold.ttf
Binary file not shown.
Binary file added static/fonts/UbuntuMono-Regular.ttf
Binary file not shown.