Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(framework): prioritize external fonts over locally installed #7184

Merged
merged 2 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions packages/base/src/css/FontFace.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,78 @@
font-family: "72";
font-style: normal;
font-weight: 400;
src: local("72"),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2"), local("72");
}

@font-face {
font-family: "72full";
font-style: normal;
font-weight: 400;
src: local('72-full'),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2"), local('72-full');

}

@font-face {
font-family: "72";
font-style: normal;
font-weight: 700;
src: local('72-Bold'),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"), local('72-Bold');
}

@font-face {
font-family: "72full";
font-style: normal;
font-weight: 700;
src: local('72-Bold-full'),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2");
}

@font-face {
font-family: '72-Bold';
font-style: normal;
src: local('72-Bold'),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"), local('72-Bold');
}

@font-face {
font-family: '72-Boldfull';
font-style: normal;
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2");
}

@font-face {
font-family: '72-Light';
font-style: normal;
src: local('72-Light'),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Light.woff2?ui5-webcomponents) format("woff2"), local('72-Light');
}

@font-face {
font-family: '72-Lightfull';
font-style: normal;
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Light-full.woff2?ui5-webcomponents) format("woff2");
}

@font-face {
font-family: '72Mono';
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72Mono-Regular.woff2?ui5-webcomponents) format('woff2'), local('72Mono');
}

@font-face {
font-family: '72Monofull';
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72Mono-Regular-full.woff2?ui5-webcomponents) format('woff2');
}

@font-face {
font-family: '72Mono-Bold';
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72Mono-Bold.woff2?ui5-webcomponents) format('woff2'), local('72Mono-Bold');
}

@font-face {
font-family: '72Mono-Boldfull';
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72Mono-Bold-full.woff2?ui5-webcomponents) format('woff2');
}

@font-face {
font-family: "72Black";
font-style: bold;
font-weight: 900;
src: local('72Black'),
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff2?ui5-webcomponents) format("woff2");
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff2?ui5-webcomponents) format("woff2"), local('72Black');
}
3 changes: 2 additions & 1 deletion packages/main/test/pages/Card.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
<ui5-card-header
id="cardHeader2a"
slot="header"
title-text="Quick Links"
class="myCardHeader--ar-he-ch"
title-text="مرحبًا שלום"
subtitle-text="Quick Links">
<img src="./img/John_Miller.png" alt="John Miller" slot="avatar">
</ui5-card-header>
Expand Down
19 changes: 19 additions & 0 deletions packages/main/test/pages/FontFace.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Font Face</title>
<script src="../../bundle.esm.js" type="module"></script>
<link rel="stylesheet" type="text/css" href="./styles/FontFace.css">
</head>

<body class="card1auto">
<ui5-label>sapFontBoldFamily</ui5-label>
<div class="boldFamily">Hello مرحبًا שלום 你好 Hallo Hola</div>
<ui5-label>sapFontBoldFamily + font-weight: 700</ui5-label>
<div class="boldFamily makeItBold">Hello مرحبًا שלום 你好 Hallo Hola</div>
<ui5-label>sapFontFamily</ui5-label>
<div class="normal">Hello مرحبًا שלום 你好 Hallo Hola</div>
</body>
6 changes: 5 additions & 1 deletion packages/main/test/pages/styles/Card.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@

.myTextContent {
padding: 0 1rem 1rem 1rem;
}
}

.myCardHeader--ar-he-ch::part(title) {
font-weight: 700;
}
11 changes: 11 additions & 0 deletions packages/main/test/pages/styles/FontFace.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.boldFamily {
font-family: var(--sapFontBoldFamily);
}

.makeItBold {
font-weight: 700;
}

.normal {
font-family: var(--sapFontFamily);
}