mirrored from git://git.rockbox.org/translate.git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhichfont.php
More file actions
131 lines (118 loc) · 4.17 KB
/
whichfont.php
File metadata and controls
131 lines (118 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* Copyright (C) 2010 Jonas Häggqvist
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
**************************************************************************/
header("Content-type: text/html; charset=UTF-8");
require_once('common.php');
/* Set internal character encoding to UTF-8 */
mb_internal_encoding("UTF-8");
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Font coverage of translations</title>
<link rel="stylesheet" href="rockbox.css" />
<style type="text/css">
td {
margin: 0px;
padding: 0px;
vertical-align: middle;
}
td img {
border: 0px solid black;
}
td.lang {
white-space: nowrap;
}
td.full {
background-color: green;
}
th {
margin: 0px;
padding: 0px;
vertical-align: bottom;
}
.rotate {
writing-mode: vertical-lr;
white-space: nowrap;
font-weight: normal;
text-orientation: sideways-right;
transform: rotate(180deg);
font-size: 13px;
min-width: 1.25em;
}
</style>
</head>
<body>
<h1>Language coverage of fonts</h1>
<p>This page attempts to visualize the language coverage of the fonts
included in the
<a href="https://download.rockbox.org/daily/fonts/rockbox-fonts.zip">Rockbox Font Pack</a>
by checking them against the codepoints used by our various translations.
The darker the square, the better coverage. A
<span style="color: green">green</span> square indicates full
coverage. Hover over the square to see a list of missing codepoints.</p>
<p>Please note that 100% coverage of our translatable strings does not
necessarily mean full coverage for arbitrary text in that (or any other)
language. This is especially true for the CJK language families.</p>
<p>Also note that individual themes often include their own embedded fonts
with varying degrees of language coverage; those are not (nor can they be)
visualized here.</p>
<p>If you wish to contribute a new font, see <a href="https://www.rockbox.org/wiki/CreateFonts">this page</a> on the wiki.</p>
<table>
<tr>
<th></th>
<?php
$fontstats = parse_ini_file('scratch/fontcoverage.ini', true);
$langs = languageinfo();
$lang_stats = get_stats();
/* Output the first row - font names */
if (isset($fontstats['english'])) {
foreach($fontstats['english'] as $font => $coverage) {
printf(" <th><span class=\"rotate\">%s</span></th>\n", $font);
}
print(" </tr>\n");
}
foreach($fontstats as $lang => $stats) {
if (substr($lang, 0, 7) === 'missing') {
continue;
}
printf(" <tr>\n <td class='lang' title='%.2f%% complete'><img src='flags/%d/%s.png' /> %s</td>\n", $lang_stats['langstats'][$lang]['percentage'], SMALL_FLAGSIZE, urlencode($langs[$lang]['flag']), $langs[$lang]['name']);
foreach($stats as $font => $coverage) {
$hover = "";
if (isset($fontstats["missing|$lang"]) && isset($fontstats["missing|$lang"][$font])) {
$hover = $fontstats["missing|$lang"][$font];
}
if ($coverage == 1) {
printf(" <td class='full' title='%s has full coverage of %s'> </td>\n", $font, $lang);
}
else {
$r = 0x9A * (1-$coverage);
$g = 0xBD * (1-$coverage);
$b = 0xDE * (1-$coverage);
printf(" <td style='background-color: #%02X%02X%02X' title='%s has %0.2f%% coverage of %s $hover'> </td>\n", $r, $g, $b, $font, $coverage*100, $lang);
}
}
print(" </tr>\n");
}
?>
</tbody>
</table>
</body>
</html>