Skip to content

Commit

Permalink
merge !119
Browse files Browse the repository at this point in the history
add instructions to @import typeface-*.css file in master stylesheet
  • Loading branch information
mojavelinux committed May 17, 2020
2 parents 8aee218 + b38cdef commit 196a727
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions docs/modules/ROOT/pages/add-fonts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
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:
There are three 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.
. Use the new font 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.
Expand Down Expand Up @@ -41,8 +40,17 @@ Here are the steps involved.
----
+
The Gulp build recognizes the `~` URL prefix and copies the font from the npm package to the build folder (and hence bundle).
+
You must define one @font-face for each font weight and style combination (e.g., `font-weight: 500` + `font-style: italic`) from the font that you want to use in your stylesheet.

. Import the typeface CSS file you just created into the main stylesheet, [.path]_src/css/site.css_ (adjacent to the other typeface imports):
+
[source,css]
----
@import "typeface-open-sans.css";
----

. Repeat the previous step for each font style and weight you want to use from that package.
. Repeat the previous steps for each font style and weight you want to use from that package.
. Change the CSS to use your newly imported font:
+
[source,css]
Expand All @@ -51,6 +59,8 @@ html {
font-family: "Open Sans", sans;
}
----
+
TIP: If you're building on the default UI, you may instead want to define or update the font family using a variable defined in [.path]_src/css/vars.css_.

. Test the new font by previewing your UI:

Expand Down Expand Up @@ -83,8 +93,17 @@ Create this folder if it does not exist.
----
+
Note that the path is a relative path starting from the [.path]_src/css_ folder to the [.path]_src/font_ folder.
+
You must define one @font-face for each font weight and style combination (e.g., `font-weight: 500` + `font-style: italic`) from the font that you want to use in your stylesheet.

. Repeat the previous step for each font style and weight you want to use.
. Import the typeface CSS file you just created into the main stylesheet, [.path]_src/css/site.css_ (adjacent to the other typeface imports):
+
[source,css]
----
@import "typeface-open-sans.css";
----

. Repeat the previous steps for each font style and weight you want to use.
. Change the CSS to use your newly imported font:
+
[source,css]
Expand All @@ -93,6 +112,8 @@ html {
font-family: "Open Sans", sans;
}
----
+
TIP: If you're building on the default UI, you may instead want to define or update the font family using a variable defined in [.path]_src/css/vars.css_.

. Test the new font by previewing your UI:

Expand Down

0 comments on commit 196a727

Please sign in to comment.