Passed
Push — master ( e1cb1b...9a76f0 )
by John
15:33 queued 17s
created

DyslexiaFont::getEnableLabel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
declare(strict_types=1);
3
/**
4
 * @copyright Copyright (c) 2022 Joas Schilling <[email protected]>
5
 *
6
 * @author Joas Schilling <[email protected]>
7
 * @author John Molakvoæ <[email protected]>
8
 *
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
namespace OCA\Theming\Themes;
26
27
use OCA\Theming\ITheme;
28
29
class DyslexiaFont extends DefaultTheme implements ITheme {
30
31
	public function getId(): string {
32
		return 'opendyslexic';
33
	}
34
35
	public function getType(): int {
36
		return ITheme::TYPE_FONT;
37
	}
38
39
	public function getTitle(): string {
40
		return $this->l->t('Dyslexia font');
41
	}
42
43
	public function getEnableLabel(): string {
44
		return $this->l->t('Enable dyslexia font');
45
	}
46
47
	public function getDescription(): string {
48
		return $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.');
49
	}
50
51
	public function getCSSVariables(): array {
52
		$variables = parent::getCSSVariables();
53
		$originalFontFace = $variables['--font-face'];
54
55
		$variables = [
56
			'--font-face' => 'OpenDyslexic, ' . $originalFontFace
57
		];
58
59
		return $variables;
60
	}
61
62
	public function getCustomCss(): string {
63
		return "
64
			@font-face {
65
				font-family: 'OpenDyslexic';
66
				font-style: normal;
67
				font-weight: 400;
68
				src: url('../fonts/OpenDyslexic-Regular.woff') format('woff'),
69
					 url('../fonts/OpenDyslexic-Regular.otf') format('opentype'),
70
					 url('../fonts/OpenDyslexic-Regular.ttf') format('truetype');
71
			}
72
			
73
			@font-face {
74
				font-family: 'OpenDyslexic';
75
				font-style: normal;
76
				font-weight: 700;
77
				src: url('../fonts/OpenDyslexic-Bold.woff') format('woff'),
78
					 url('../fonts/OpenDyslexic-Bold.otf') format('opentype'),
79
					 url('../fonts/OpenDyslexic-Bold.ttf') format('truetype');
80
			}
81
		";
82
	}
83
}
84
85