Skip to content

Commit

Permalink
Load fallback fonts with adjusted sizes.
Browse files Browse the repository at this point in the history
  • Loading branch information
smockle committed May 25, 2019
1 parent 1a29d55 commit 7efeff6
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
8 changes: 8 additions & 0 deletions gatsby-config.js
Expand Up @@ -27,6 +27,14 @@ module.exports = {
}, },
"gatsby-transformer-sharp", "gatsby-transformer-sharp",
"gatsby-plugin-sharp", "gatsby-plugin-sharp",
{
resolve: "gatsby-plugin-web-font-loader",
options: {
custom: {
families: ["Lato", "Crimson Pro S"]
}
}
},
"gatsby-plugin-catch-links", "gatsby-plugin-catch-links",
{ {
resolve: "gatsby-plugin-canonical-urls", resolve: "gatsby-plugin-canonical-urls",
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -17,6 +17,7 @@
"gatsby-plugin-s3": "^0.2.5", "gatsby-plugin-s3": "^0.2.5",
"gatsby-plugin-sharp": "^2.1.0", "gatsby-plugin-sharp": "^2.1.0",
"gatsby-plugin-typescript": "^2.0.14", "gatsby-plugin-typescript": "^2.0.14",
"gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-remark-images": "^3.0.12", "gatsby-remark-images": "^3.0.12",
"gatsby-remark-vscode": "^1.0.3", "gatsby-remark-vscode": "^1.0.3",
"gatsby-source-filesystem": "^2.0.37", "gatsby-source-filesystem": "^2.0.37",
Expand Down
38 changes: 36 additions & 2 deletions src/styles/global.css
@@ -1,7 +1,7 @@
/* Variables */ /* Variables */
:root { :root {
--font-title: "Lato", sans-serif; --font-title: "Lato", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
--font-body: "Crimson Pro S", serif; --font-body: "Crimson Pro S", "Georgia", serif;
--font-code: "SF Mono", Menlo, monospace; --font-code: "SF Mono", Menlo, monospace;
} }
/* @media (prefers-color-scheme: no-preference), (prefers-color-scheme: light) { */ /* @media (prefers-color-scheme: no-preference), (prefers-color-scheme: light) { */
Expand Down Expand Up @@ -32,27 +32,31 @@
url("fonts/lato-black.woff2") format("woff2"); url("fonts/lato-black.woff2") format("woff2");
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-display: swap;
} }
@font-face { @font-face {
font-family: "Crimson Pro S"; font-family: "Crimson Pro S";
src: local("CrimsonProS Regular"), local("CrimsonProS-Regular"), src: local("CrimsonProS Regular"), local("CrimsonProS-Regular"),
url("fonts/crimsonpros-regular.woff2") format("woff2"); url("fonts/crimsonpros-regular.woff2") format("woff2");
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
font-display: swap;
} }
@font-face { @font-face {
font-family: "Crimson Pro S"; font-family: "Crimson Pro S";
src: local("CrimsonProS Italic"), local("CrimsonProS-Italic"), src: local("CrimsonProS Italic"), local("CrimsonProS-Italic"),
url("fonts/crimsonpros-italic.woff2") format("woff2"); url("fonts/crimsonpros-italic.woff2") format("woff2");
font-weight: 400; font-weight: 400;
font-style: italic; font-style: italic;
font-display: swap;
} }
@font-face { @font-face {
font-family: "Crimson Pro S"; font-family: "Crimson Pro S";
src: local("CrimsonProS Bold"), local("CrimsonProS-Bold"), src: local("CrimsonProS Bold"), local("CrimsonProS-Bold"),
url("fonts/crimsonpros-bold.woff2") format("woff2"); url("fonts/crimsonpros-bold.woff2") format("woff2");
font-weight: 700; font-weight: 700;
font-style: normal; font-style: normal;
font-display: swap;
} }


/* Base */ /* Base */
Expand All @@ -66,6 +70,28 @@ html, body, div, span, object, iframe, h1, h2, h3, h4, p, blockquote, pre, a, ad
} }
pre, code, kbd { font-family: var(--font-code); } pre, code, kbd { font-family: var(--font-code); }
pre { white-space: pre-wrap; } pre { white-space: pre-wrap; }
html:not(.wf-crimsonpros-n4-active) :not(li) > p,
html:not(.wf-crimsonpros-n4-active) i,
html:not(.wf-crimsonpros-n4-active) :not(li) > ul,
html:not(.wf-crimsonpros-n4-active) :not(li) > ol,
html:not(.wf-crimsonpros-n4-active) blockquote,
html:not(.wf-crimsonpros-n4-active) table,
html:not(.wf-crimsonpros-n4-active) figure {
font-size: 17px;
line-height: 1.75;
letter-spacing: 0.4px;
}
@media (min-width: 50em) {
html:not(.wf-crimsonpros-n4-active) :not(li) > p,
html:not(.wf-crimsonpros-n4-active) i,
html:not(.wf-crimsonpros-n4-active) :not(li) > ul,
html:not(.wf-crimsonpros-n4-active) :not(li) > ol,
html:not(.wf-crimsonpros-n4-active) blockquote,
html:not(.wf-crimsonpros-n4-active) table,
html:not(.wf-crimsonpros-n4-active) figure {
font-size: 19px;
}
}
html { html {
font-family: var(--font-body); font-family: var(--font-body);
font-size: 20px; font-size: 20px;
Expand Down Expand Up @@ -114,6 +140,14 @@ main > :not(:only-child) > :last-child,
} }


/* Font Size */ /* Font Size */
html:not(.wf-lato-n4-active) h1,
html:not(.wf-lato-n4-active) h2,
html:not(.wf-lato-n4-active) h3,
html:not(.wf-lato-n4-active) h4 {
font-weight: 700;
letter-spacing: -1px;
word-spacing: -0.5px;
}
h1, h2, h3, h4 { h1, h2, h3, h4 {
font-family: var(--font-title); font-family: var(--font-title);
line-height: 1.05; line-height: 1.05;
Expand Down

0 comments on commit 7efeff6

Please sign in to comment.