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(a11y): Update OpenDyslexic from 0.920 to 2.001 #47928

Merged
merged 2 commits into from
Sep 14, 2024
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
8 changes: 4 additions & 4 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Files: .tx/config
Copyright: 2011-2012 ownCloud, Inc., 2017-2023 Nextcloud GmbH and Nextcloud contributors
License: AGPL-3.0-only

Files: .htaccess
Files: .htaccess
Copyright: 2011-2016 ownCloud, Inc., 2016-2024 Nextcloud GmbH and Nextcloud contributors
License: AGPL-3.0-only

Expand Down Expand Up @@ -204,7 +204,7 @@ Copyright: 2016-2024 Collabora Ltd.
License: LicenseRef-CollaboraTrademarks

Files: core/img/twitter.svg core/img/actions/twitter.svg apps/federatedfilesharing/img/social-twitter.svg
Copyright: X Corp.
Copyright: X Corp.
License: LicenseRef-XTrademarks

Files: core/img/facebook.svg apps/federatedfilesharing/img/social-facebook.svg
Expand Down Expand Up @@ -327,6 +327,6 @@ Files: apps/settings/tests/UserMigration/assets/account.png
Copyright: 2019 Fabian Wiktor <https://www.pexels.com/photo/green-and-brown-island-on-blue-sea-under-blue-sky-4011450/>
License: CC0-1.0

Files: apps/theming/fonts/OpenDyslexic-Bold.otf apps/theming/fonts/OpenDyslexic-Bold.ttf apps/theming/fonts/OpenDyslexic-Bold.woff apps/theming/fonts/OpenDyslexic-Regular.otf apps/theming/fonts/OpenDyslexic-Regular.ttf apps/theming/fonts/OpenDyslexic-Regular.woff
Copyright: 2012-2019 Abbie Gonzalez <https://abbiecod.es|support@abbiecod.es<, with Reserved Font Name OpenDyslexic.
Files: apps/theming/fonts/OpenDyslexic-Bold.otf apps/theming/fonts/OpenDyslexic-Regular.otf
Copyright: 2012-2019 Abbie Gonzalez <https://abbiecod.es|support@abbiecod.es>, with Reserved Font Name OpenDyslexic.
License: OFL-1.1-RFN
Binary file modified apps/theming/fonts/OpenDyslexic-Bold.otf
Binary file not shown.
Binary file removed apps/theming/fonts/OpenDyslexic-Bold.ttf
Binary file not shown.
Binary file removed apps/theming/fonts/OpenDyslexic-Bold.woff
Binary file not shown.
Binary file modified apps/theming/fonts/OpenDyslexic-Regular.otf
Binary file not shown.
Binary file removed apps/theming/fonts/OpenDyslexic-Regular.ttf
Binary file not shown.
Binary file removed apps/theming/fonts/OpenDyslexic-Regular.woff
Binary file not shown.
14 changes: 3 additions & 11 deletions apps/theming/lib/Themes/DyslexiaFont.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,22 @@ public function getCSSVariables(): array {
}

public function getCustomCss(): string {
$fontPathWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.woff');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otf is supported by all supported browsers (IE was the last one), so we can drop the others

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside browser support, WOFF is generaly more lightweight too.

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But WOFF is not provided by the creator and I don't know what happens with licenses when using a convertor of any kind ¯\_(ツ)_/¯ The files are ~41KB and ~42KB. I really don't care too much about such a little size to risk license issues

Copy link
Member Author

@nickvergessen nickvergessen Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, the old font file was ~250KB and the WOFF was ~120KB there it made a bit more sense

$fontPathOtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.otf');
$fontPathTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Regular.ttf');
$boldFontPathWoff = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.woff');
$boldFontPathOtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.otf');
$boldFontPathTtf = $this->urlGenerator->linkTo('theming', 'fonts/OpenDyslexic-Bold.ttf');

return "
@font-face {
font-family: 'OpenDyslexic';
font-style: normal;
font-weight: 400;
src: url('$fontPathWoff') format('woff'),
url('$fontPathOtf') format('opentype'),
url('$fontPathTtf') format('truetype');
src: url('$fontPathOtf') format('opentype');
}

@font-face {
font-family: 'OpenDyslexic';
font-style: normal;
font-weight: 700;
src: url('$boldFontPathWoff') format('woff'),
url('$boldFontPathOtf') format('opentype'),
url('$boldFontPathTtf') format('truetype');
src: url('$boldFontPathOtf') format('opentype');
}
";
}
Expand Down
2 changes: 1 addition & 1 deletion apps/theming/tests/Themes/DyslexiaFontTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function testGetCustomCss($webRoot, $prettyUrlsEnabled) {
->with('htaccess.IgnoreFrontController', false)
->willReturn($prettyUrlsEnabled);

$this->assertStringContainsString("'$webRoot/apps/theming/fonts/OpenDyslexic-Regular.woff'", $this->dyslexiaFont->getCustomCss());
$this->assertStringContainsString("'$webRoot/apps/theming/fonts/OpenDyslexic-Regular.otf'", $this->dyslexiaFont->getCustomCss());
$this->assertStringNotContainsString('index.php', $this->dyslexiaFont->getCustomCss());
}
}
Loading