Skip to content

Commit

Permalink
Merge pull request #362 from adobe/unify-font
Browse files Browse the repository at this point in the history
chore: unify font
  • Loading branch information
fkakatie authored Jul 30, 2024
2 parents 8f226c2 + afee66e commit 516d856
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 39 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

main.error .error-number text {
font-family: var(--fixed-font-family);
font-family: monospace;
}
</style>
<link rel="stylesheet" href="/styles/lazy-styles.css">
Expand Down
2 changes: 1 addition & 1 deletion blocks/footer/footer.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
footer {
padding: 2rem;
background-color: var(--light-color);
font-size: var(--body-font-size-s);
font-size: var(--body-font-size-xs);
}

footer .footer {
Expand Down
8 changes: 2 additions & 6 deletions blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ header nav {
max-width: 1264px;
height: var(--nav-height);
padding: 0 1rem;
font-family: var(--body-font-family);
}

header nav[aria-expanded='true'] {
Expand Down Expand Up @@ -171,19 +170,18 @@ header nav .nav-sections ul {
list-style: none;
padding-left: 0;
font-size: var(--body-font-size-s);
font-weight: 500;
}

header nav .nav-sections ul > li {
font-weight: 700;
font-weight: 500;
}

header nav .nav-sections ul > li > ul {
margin-top: 0;
}

header nav .nav-sections ul > li > ul > li {
font-weight: 500;
font-weight: 400;
}

@media (width >= 900px) {
Expand Down Expand Up @@ -227,13 +225,11 @@ header nav .nav-sections ul > li > ul > li {
display: flex;
gap: 2em;
margin: 0;
font-size: var(--body-font-size-xs);
}

header nav .nav-sections .default-content-wrapper > ul > li {
flex: 0 1 auto;
position: relative;
font-weight: 500;
}

header nav .nav-sections .default-content-wrapper > ul > li > ul {
Expand Down
Binary file added fonts/roboto-condensed-bold.woff2
Binary file not shown.
Binary file added fonts/roboto-medium.woff2
Binary file not shown.
18 changes: 18 additions & 0 deletions styles/fonts.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/* stylelint-disable max-line-length */
@font-face {
font-family: roboto-condensed;
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('../fonts/roboto-condensed-bold.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: roboto;
font-style: normal;
Expand All @@ -8,6 +17,15 @@
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: roboto;
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('../fonts/roboto-medium.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
font-family: roboto;
font-style: normal;
Expand Down
73 changes: 42 additions & 31 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,61 @@
--text-color: black;

/* fonts */
--body-font-family: roboto, roboto-fallback;
--heading-font-family: var(--body-font-family);
--fixed-font-family: 'Roboto Mono', menlo, consolas, 'Liberation Mono', monospace;
--body-font-family: roboto, roboto-fallback, sans-serif;
--heading-font-family: roboto-condensed, roboto-condensed-fallback, sans-serif;

/* body sizes */
--body-font-size-m: 22px;
--body-font-size-s: 18px;
--body-font-size-xs: 16px;
--body-font-size-s: 19px;
--body-font-size-xs: 17px;

/* heading sizes */
--heading-font-size-xxl: 48px;
--heading-font-size-xl: 40px;
--heading-font-size-l: 32px;
--heading-font-size-m: 24px;
--heading-font-size-s: 20px;
--heading-font-size-xs: 18px;
--heading-font-size-xxl: 55px;
--heading-font-size-xl: 44px;
--heading-font-size-l: 34px;
--heading-font-size-m: 27px;
--heading-font-size-s: 24px;
--heading-font-size-xs: 22px;

/* nav height */
--nav-height: 64px;
}

/* fallback fonts */
@font-face {
font-family: roboto-condensed-fallback;
size-adjust: 88.82%;
src: local('Arial');
}

@font-face {
font-family: roboto-fallback;
size-adjust: 100.06%;
ascent-override: 95%;
size-adjust: 99.529%;
src: local('Arial');
}

@media (width >= 900px) {
:root {
--heading-font-size-xxl: 60px;
--heading-font-size-xl: 48px;
--heading-font-size-l: 36px;
--heading-font-size-m: 30px;
--heading-font-size-s: 24px;
--heading-font-size-xs: 22px;
/* body sizes */
--body-font-size-m: 18px;
--body-font-size-s: 16px;
--body-font-size-xs: 14px;

/* heading sizes */
--heading-font-size-xxl: 45px;
--heading-font-size-xl: 36px;
--heading-font-size-l: 28px;
--heading-font-size-m: 22px;
--heading-font-size-s: 20px;
--heading-font-size-xs: 18px;
}
}

body {
font-size: var(--body-font-size-m);
margin: 0;
font-family: var(--body-font-family);
line-height: 1.6;
font-size: var(--body-font-size-m);
line-height: 1.5;
color: var(--text-color);
background-color: var(--background-color);
display: none;
Expand All @@ -84,8 +95,8 @@ h4,
h5,
h6 {
font-family: var(--heading-font-family);
font-weight: 600;
line-height: 1.25;
font-weight: 700;
line-height: 1.3;
margin-top: 1em;
margin-bottom: 0.5em;
scroll-margin: calc(var(--nav-height) + 1em);
Expand All @@ -108,12 +119,6 @@ blockquote {
margin-bottom: 1em;
}

code,
pre {
font-family: var(--fixed-font-family);
font-size: var(--body-font-size-s);
}

code {
padding: 0.125em;
}
Expand All @@ -130,6 +135,13 @@ main pre {
white-space: pre;
}

input,
textarea,
select,
button {
font: inherit;
}

/* links */
a:any-link {
color: var(--link-color);
Expand All @@ -144,15 +156,14 @@ a:hover {
/* buttons */
a.button:any-link,
button {
font-family: var(--body-font-family);
display: inline-block;
box-sizing: border-box;
text-decoration: none;
border: 2px solid transparent;
padding: 5px 30px;
text-align: center;
font-weight: 500;
font-style: normal;
font-weight: 600;
cursor: pointer;
color: var(--background-color);
background-color: var(--link-color);
Expand Down

0 comments on commit 516d856

Please sign in to comment.