-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update-with-latest-master' into ods-docs-ui
- Loading branch information
Showing
70 changed files
with
2,293 additions
and
9,887 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
= Add Fonts | ||
|
||
This page explains how to add new fonts to your UI. | ||
These instructions assume you've forked the default UI and are able to customize it. | ||
|
||
There are two steps involved: | ||
|
||
. Add the font to your UI project | ||
. Add a font-face declaration to your stylesheet | ||
|
||
You can then reference the font family in your stylesheet. | ||
|
||
How you reference the font file in the font-face declaration depends on how you decide to manage it. | ||
You can manage the font with npm or download it manually and add it directly to your UI project. | ||
The following sections describe each approach in turn. | ||
|
||
== npm managed | ||
|
||
You can use npm (or Yarn) to manage the font. | ||
This approach saves you from having to store the font file directly in your UI project. | ||
Here are the steps involved. | ||
|
||
. Use npm (or Yarn) to install the font files from a package (e.g., https://www.npmjs.com/package/typeface-open-sans[typeface-open-sans]) | ||
|
||
$ npm install --save typeface-open-sans | ||
|
||
. In [.path]_src/css_, add a corresponding CSS file (e.g., [.path]_typeface-open-sans.css_) | ||
. In that file, declare the font face: | ||
+ | ||
[source,css] | ||
---- | ||
@font-face { | ||
font-family: "Open Sans"; | ||
font-style: normal; | ||
font-weight: 400; | ||
src: | ||
local("Open Sans"), | ||
local("Open Sans-Regular"), | ||
url(~typeface-open-sans/files/open-sans-latin-400.woff) format("woff") | ||
} | ||
---- | ||
+ | ||
The Gulp build recognizes the `~` URL prefix and copies the font from the npm package to the build folder (and hence bundle). | ||
|
||
. Repeat the previous step for each font style and weight you want to use from that package. | ||
. Change the CSS to use your newly imported font: | ||
+ | ||
[source,css] | ||
---- | ||
html { | ||
font-family: "Open Sans", sans; | ||
} | ||
---- | ||
|
||
. Test the new font by previewing your UI: | ||
|
||
$ gulp preview | ||
|
||
If you see the new font, you've now successfully added it to your UI. | ||
If you aren't sure, look for the https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Edit_fonts[All fonts on page] section in your browser's developer tools to see whether the font was loaded. | ||
|
||
== Manual | ||
|
||
A simpler approach to adding fonts is to store them directly in your project. | ||
Here are the steps involved. | ||
|
||
. Download the font files and add them to the [.path]_src/font_ folder. | ||
Create this folder if it does not exist. | ||
. In [.path]_src/css_, add a corresponding CSS file (e.g., [.path]_typeface-open-sans.css_) | ||
. In that file, declare the font face: | ||
+ | ||
[source,css] | ||
---- | ||
@font-face { | ||
font-family: "Open Sans"; | ||
font-style: normal; | ||
font-weight: 400; | ||
src: | ||
local("Open Sans"), | ||
local("Open Sans-Regular"), | ||
url(../font/open-sans-latin-400.woff) format("woff") | ||
} | ||
---- | ||
+ | ||
Note that the path is a relative path starting from the [.path]_src/css_ folder to the [.path]_src/font_ folder. | ||
|
||
. Repeat the previous step for each font style and weight you want to use. | ||
. Change the CSS to use your newly imported font: | ||
+ | ||
[source,css] | ||
---- | ||
html { | ||
font-family: "Open Sans", sans; | ||
} | ||
---- | ||
|
||
. Test the new font by previewing your UI: | ||
|
||
$ gulp preview | ||
|
||
If you see the new font, you've now successfully added it to your UI. | ||
If you aren't sure, look for the https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Edit_fonts[All fonts on page] section in your browser's developer tools to see whether the font was loaded. |
Oops, something went wrong.