summaryrefslogtreecommitdiffstats
path: root/whichfont.php
blob: 68569da861a388802c7673a18a7a0a20ae4bd662 (plain)
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
<?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 lists fonts included with Rockbox and tries to visualise their
coverage of the included translations. The darker the square, the better
coverage. A <span style="color: green">green</span> square indicates full
coverage.</p>

<table>
  <tr>
    <th></th>
<?php

$fontstats = parse_ini_file('scratch/fontcoverage.ini', true);
$langs = languageinfo();

/* 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) {
    printf("  <tr>\n    <td class='lang'><img src='flags/%d/%s.png' /> %s</td>\n",SMALL_FLAGSIZE, urlencode($langs[$lang]['flag']), $langs[$lang]['name']);
    foreach($stats as $font => $coverage) {
        if ($coverage == 1) {
            printf("    <td class='full' title='%s has full coverage of %s'>&nbsp;</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'>&nbsp;</td>", $r, $g, $b, $font, $coverage*100, $lang);
        }
    }
    print("  </tr>\n");
}
?>
</tbody>
</table>
</body>
</html>