From 9c98330ea465c71d568712b5f7926737650f0197 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 17 Jul 2018 19:16:14 -0300 Subject: [PATCH] Self host fonts and fix font weights --- package-lock.json | 12 +++++ package.json | 2 + src/core/client/ui/shared/typography.css | 58 ++++++++++++++++++++++++ src/core/client/ui/theme/variables.ts | 2 +- 4 files changed, 73 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 57e782760..ef871d5e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21764,6 +21764,18 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typeface-manuale": { + "version": "0.0.54", + "resolved": "https://registry.npmjs.org/typeface-manuale/-/typeface-manuale-0.0.54.tgz", + "integrity": "sha512-wWgWFPSvoxEDdm8Dmq0cZzgmBfRXho5WhxU6x4dKBk7WIBsyvRgcjT+j7cQ3ah/9VYp1+nJzQWhCue+TiqA7FA==", + "dev": true + }, + "typeface-source-sans-pro": { + "version": "0.0.54", + "resolved": "https://registry.npmjs.org/typeface-source-sans-pro/-/typeface-source-sans-pro-0.0.54.tgz", + "integrity": "sha512-4nsvldyZsOBuvR4oEuUMTquJFVssP4iIVnMEIU4paCWo2940b6r/t95sk7KwDpCablS8DprM/YlhpgqnS7gpKg==", + "dev": true + }, "typescript": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", diff --git a/package.json b/package.json index dfd500620..b6a2f6697 100644 --- a/package.json +++ b/package.json @@ -158,6 +158,8 @@ "tslint-plugin-prettier": "^1.3.0", "tslint-react": "^3.6.0", "typed-css-modules": "^0.3.4", + "typeface-manuale": "0.0.54", + "typeface-source-sans-pro": "0.0.54", "typescript": "^2.9.2", "uglifyjs-webpack-plugin": "^1.2.5", "webpack": "4.12.0", diff --git a/src/core/client/ui/shared/typography.css b/src/core/client/ui/shared/typography.css index 3cb483cd2..edc334b96 100644 --- a/src/core/client/ui/shared/typography.css +++ b/src/core/client/ui/shared/typography.css @@ -1,3 +1,61 @@ +@font-face { + font-family: "Source Sans Pro"; + font-style: normal; + font-display: swap; + font-weight: 300; + src: local("Source Sans Pro Light "), local("Source Sans Pro-Light"), + url("typeface-source-sans-pro/files/source-sans-pro-latin-300.woff2") + format("woff2"), + url("typeface-source-sans-pro/files/source-sans-pro-latin-300.woff") + format("woff"); +} + +@font-face { + font-family: "Source Sans Pro"; + font-style: normal; + font-display: swap; + font-weight: 400; + src: local("Source Sans Pro Regular italic"), + local("Source Sans Pro-Regularitalic"), + url("typeface-source-sans-pro/files/source-sans-pro-latin-400.woff2") + format("woff2"), + url("typeface-source-sans-pro/files/source-sans-pro-latin-400.woff") + format("woff"); +} + +@font-face { + font-family: "Source Sans Pro"; + font-style: normal; + font-display: swap; + font-weight: 600; + src: local("Source Sans Pro SemiBold italic"), + local("Source Sans Pro-SemiBolditalic"), + url("typeface-source-sans-pro/files/source-sans-pro-latin-600.woff2") + format("woff2"), + url("typeface-source-sans-pro/files/source-sans-pro-latin-600.woff") + format("woff"); +} + +@font-face { + font-family: "Manuale"; + font-style: normal; + font-display: swap; + font-weight: 400; + src: local("Manuale Regular "), local("Manuale-Regular"), + url("typeface-manuale/files/manuale-latin-400.woff2") format("woff2"), + url("typeface-manuale/files/manuale-latin-400.woff") format("woff"); +} + +@font-face { + font-family: "Manuale"; + font-style: normal; + font-display: swap; + font-weight: 600; + src: local("Manuale SemiBold "), local("Manuale-SemiBold"), + url("typeface-manuale/files/manuale-latin-600.woff2") format("woff2"), + url("typeface-manuale/files/manuale-latin-600.woff") format("woff"); +} + .heading1 { font-size: calc(24rem / var(--rem-base)); font-weight: var(--font-weight-medium); diff --git a/src/core/client/ui/theme/variables.ts b/src/core/client/ui/theme/variables.ts index 50404b427..6e404f10f 100644 --- a/src/core/client/ui/theme/variables.ts +++ b/src/core/client/ui/theme/variables.ts @@ -68,7 +68,7 @@ const variables = { fontSize: 16, fontWeightLight: 300, fontWeightRegular: 400, - fontWeightMedium: 550, + fontWeightMedium: 600, /* Breakpoints */ breakpoints: { xs: 320,