Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 1 | <?php |
Solomon Peachy | a0eef36 | 2020-04-02 10:05:23 -0400 | [diff] [blame] | 2 | /************************************************************************ |
| 3 | * __________ __ ___. |
| 4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 8 | * \/ \/ \/ \/ \/ |
| 9 | * Copyright (C) 2010 Jonas Häggqvist |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version 2 |
| 14 | * of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 17 | * KIND, either express or implied. |
| 18 | * |
| 19 | **************************************************************************/ |
| 20 | |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 21 | header("Content-type: text/html; charset=UTF-8"); |
| 22 | require_once('common.php'); |
| 23 | /* Set internal character encoding to UTF-8 */ |
| 24 | mb_internal_encoding("UTF-8"); |
| 25 | ?> |
| 26 | <!DOCTYPE html> |
| 27 | <html> |
| 28 | <head> |
| 29 | <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> |
| 30 | <title>Font coverage of translations</title> |
| 31 | <link rel="stylesheet" href="rockbox.css" /> |
| 32 | <style type="text/css"> |
Solomon Peachy | 1ec9ad1 | 2020-09-12 00:48:31 -0400 | [diff] [blame] | 33 | |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 34 | td { |
| 35 | margin: 0px; |
| 36 | padding: 0px; |
| 37 | vertical-align: middle; |
| 38 | } |
| 39 | td img { |
| 40 | border: 0px solid black; |
| 41 | } |
| 42 | td.lang { |
| 43 | white-space: nowrap; |
| 44 | } |
| 45 | td.full { |
| 46 | background-color: green; |
| 47 | } |
Solomon Peachy | 1ec9ad1 | 2020-09-12 00:48:31 -0400 | [diff] [blame] | 48 | th { |
| 49 | margin: 0px; |
| 50 | padding: 0px; |
| 51 | vertical-align: bottom; |
| 52 | } |
| 53 | |
| 54 | .rotate { |
| 55 | writing-mode: vertical-lr; |
| 56 | white-space: nowrap; |
| 57 | font-weight: normal; |
| 58 | text-orientation: sideways-right; |
| 59 | transform: rotate(180deg); |
| 60 | font-size: 13px; |
| 61 | min-width: 1.25em; |
| 62 | } |
| 63 | |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 64 | </style> |
| 65 | </head> |
| 66 | <body> |
| 67 | |
| 68 | <h1>Language coverage of fonts</h1> |
| 69 | |
| 70 | <p>This page lists fonts included with Rockbox and tries to visualise their |
| 71 | coverage of the included translations. The darker the square, the better |
| 72 | coverage. A <span style="color: green">green</span> square indicates full |
| 73 | coverage.</p> |
| 74 | |
| 75 | <table> |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 76 | <tr> |
Solomon Peachy | 1ec9ad1 | 2020-09-12 00:48:31 -0400 | [diff] [blame] | 77 | <th></th> |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 78 | <?php |
| 79 | |
Solomon Peachy | 817a336 | 2020-07-27 13:27:53 -0400 | [diff] [blame] | 80 | $fontstats = parse_ini_file('scratch/fontcoverage.ini', true); |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 81 | $langs = languageinfo(); |
| 82 | |
| 83 | /* Output the first row - font names */ |
Frank Gevaerts | f6a9d68 | 2012-04-04 21:26:38 +0200 | [diff] [blame] | 84 | if (isset($fontstats['english'])) { |
| 85 | foreach($fontstats['english'] as $font => $coverage) { |
Solomon Peachy | 1ec9ad1 | 2020-09-12 00:48:31 -0400 | [diff] [blame] | 86 | printf(" <th><span class=\"rotate\">%s</span></th>\n", $font); |
Frank Gevaerts | f6a9d68 | 2012-04-04 21:26:38 +0200 | [diff] [blame] | 87 | } |
Solomon Peachy | 1ec9ad1 | 2020-09-12 00:48:31 -0400 | [diff] [blame] | 88 | print(" </tr>\n"); |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 89 | } |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 90 | |
| 91 | foreach($fontstats as $lang => $stats) { |
| 92 | printf(" <tr>\n <td class='lang'><img src='flags/%d/%s.png' /> %s</td>\n",SMALL_FLAGSIZE, urlencode($langs[$lang]['flag']), $langs[$lang]['name']); |
| 93 | foreach($stats as $font => $coverage) { |
| 94 | if ($coverage == 1) { |
| 95 | printf(" <td class='full' title='%s has full coverage of %s'> </td>\n", $font, $lang); |
| 96 | } |
| 97 | else { |
| 98 | $r = 0x9A * (1-$coverage); |
| 99 | $g = 0xBD * (1-$coverage); |
| 100 | $b = 0xDE * (1-$coverage); |
| 101 | printf(" <td style='background-color: #%02X%02X%02X' title='%s has %0.2f%% coverage of %s'> </td>", $r, $g, $b, $font, $coverage*100, $lang); |
Solomon Peachy | a0eef36 | 2020-04-02 10:05:23 -0400 | [diff] [blame] | 102 | } |
Jonas Häggqvist | 45f3dfb | 2011-04-18 21:32:14 +0000 | [diff] [blame] | 103 | } |
| 104 | print(" </tr>\n"); |
| 105 | } |
| 106 | ?> |
| 107 | </tbody> |
| 108 | </table> |
| 109 | </body> |
| 110 | </html> |