Skip to content

Commit

Permalink
IONOS(theming): ionos-theme: use OpenSans as --font-face
Browse files Browse the repository at this point in the history
Signed-off-by: Misha M.-Kupriyanov <[email protected]>
  • Loading branch information
printminion-co committed Sep 11, 2024
1 parent b1f9a92 commit 8378abe
Show file tree
Hide file tree
Showing 16 changed files with 4,971 additions and 0 deletions.
Binary file not shown.
1,635 changes: 1,635 additions & 0 deletions apps/theming/fonts/OpenSans/OpenSans-Bold-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,637 changes: 1,637 additions & 0 deletions apps/theming/fonts/OpenSans/OpenSans-Regular-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,637 changes: 1,637 additions & 0 deletions apps/theming/fonts/OpenSans/OpenSans-SemiBold-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
62 changes: 62 additions & 0 deletions apps/theming/lib/Themes/Ionos/LightTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,73 @@ public function getMeta(): array {

public function getCSSVariables(): array {
$defaultVariables = parent::getCSSVariables();
$originalFontFace = $defaultVariables['--font-face'];

return array_merge(
$defaultVariables,
[
'--font-face' => '"Open sans", ' . $originalFontFace
]
);
}

public function getCustomCss(): string {
$regularEot = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Regular-webfont.eot');
$regularWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Regular-webfont.woff');
$regularWoff2 = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Regular-webfont.woff2');
$regularTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Regular-webfont.ttf');
$regularSvg = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Regular-webfont.svg#open_sansregular');

$semiBoldEot = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-SemiBold-webfont.eot');
$semiBoldWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-SemiBold-webfont.woff');
$semiBoldWoff2 = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-SemiBold-webfont.woff2');
$semiBoldTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-SemiBold-webfont.ttf');
$semiBoldSvg = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-SemiBold-webfont.svg#open_sansregular');

$boldEot = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Bold-webfont.eot');
$boldWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Bold-webfont.woff');
$boldWoff2 = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Bold-webfont.woff2');
$boldTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Bold-webfont.ttf');
$boldSvg = $this->urlGenerator->linkTo('theming', 'fonts/OpenSans/OpenSans-Bold-webfont.svg#open_sansregular');

return "
@font-face {
font-family: 'Open sans';
src: url('$regularEot') format('embedded-opentype'),
url('$regularWoff') format('woff'),
url('$regularWoff2') format('woff2'),
url('$regularTtf') format('truetype'),
url('$regularSvg') format('svg');
font-weight: normal;
font-style: normal;
font-display: swap;
}
/* Open sans semi-bold variant */
@font-face {
font-family: 'Open sans';
src: url('$semiBoldEot') format('embedded-opentype'),
url('$semiBoldWoff') format('woff'),
url($semiBoldWoff2) format('woff2'),
url('$semiBoldTtf') format('truetype'),
url('$semiBoldSvg') format('svg');
font-weight: 600;
font-style: normal;
font-display: swap;
}
/* Open sans bold variant */
@font-face {
font-family: 'Open sans';
src: url('$boldEot') format('embedded-opentype'),
url('$boldWoff') format('woff'),
url('$boldWoff2') format('woff2'),
url('$boldTtf') format('truetype'),
url('$boldSvg') format('svg');
font-weight: bold;
font-style: normal;
font-display: swap;
}
";
}
}

0 comments on commit 8378abe

Please sign in to comment.