Skip to content

Commit

Permalink
open images in new widnow
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed Mar 8, 2024
1 parent 58965d3 commit 4e0e3ee
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/utils/fontUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import toBase64 from "./toBase64";

Check failure on line 1 in src/utils/fontUtils.js

View workflow job for this annotation

GitHub Actions / build

'toBase64' is defined but never used
import SBBWebRomanPath from "./fonts/SBBWeb-Roman.ttf";
import SBBWebLightPath from "./fonts/SBBWeb-Light.ttf";
// import SBBWebRomanPath from "./fonts/SBBWeb-Roman.ttf";
// import SBBWebLightPath from "./fonts/SBBWeb-Light.ttf";
import SBBWebBoldPath from "./fonts/SBBWeb-Bold.ttf";
import SBBWebItalicPath from "./fonts/SBBWeb-Italic.ttf";
import SBBWebUltraLightPath from "./fonts/SBBWeb-UltraLight.ttf";
Expand All @@ -11,12 +11,12 @@ export const sbbWebRoman = {
// file: SBBWebRomanPath,

family: "SBBWeb-Roman",
file: "https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Roman",
file: "https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Roman.woff",
};

export const sbbWebLight = {
family: "SBBWeb-Light",
file: "https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Light",
file: "https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Light.woff",
};

export const sbbWebUltraLight = {
Expand All @@ -42,13 +42,15 @@ export const sbbWebThin = {
const cache = {};
export const getFontBase64FontFace = async (file, fontFamily) => {
if (!cache[fontFamily]) {
const fontBase64 = await fetch(file)
.then((res) => res.blob())
.then((blob) => toBase64(blob));
// const fontBase64 = await fetch(file)
// .then((res) => res.blob())
// .then((blob) => toBase64(blob));
cache[fontFamily] = `
@font-face {
src: url(${fontBase64});
src: url(${file}) format('woff');
font-family: '${fontFamily}';
font-weight: normal;
font-style: normal;
}
`;
}
Expand Down

0 comments on commit 4e0e3ee

Please sign in to comment.