DejaVu 1.11 was released recently. This is a high quality free typeface
that would be an improvement for at least Hungarian (based on testing it
in-game) and Turkish (based on ihsan's comments). Moreover, it is planned
to further improve this typeface, see http://dejavu.sourceforge.net/ for
the roadmap. Hence, I looked in more detail at what would be required
to add this to the game. DejaVu is based on Bitstream Vera 1.10 just
like Vera is, but adds many additional glyphs not found in Vera.
First, looking at the status.txt file in the DejaVu distribution, it
appears that DejaVuSans.ttf (version 1.11) has all the codepoints that
appear in the Vera and Bepa-Roman codepoint lists in data/fonts.cfg,
and visually this is identical to our existing default Vera. However,
FreeSans contains some codepoints not in DejaVu. This was the list of
codepoints I extracted from status.txt for DejaVuSans:
32-126,160-293,296-311,313-328,332-357,360-382,402,452-460,482-483,490-493,536-539,558-559,562-563,567,699,710-711,728-733,786,806,937,960,1024-1119,7808-7813,7922-7923,8208-8213,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710,8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9251,9674,64257-64258
Running the following script then gave codepoint lists currently in use
for each language we support, based on their po files:
for f in `cat po/wesnoth/LINGUAS`; do
find po -name "$f.po" -print | xargs cat | \
perl -ne 'BEGIN { use Unicode::String } $u = Unicode::String->new($_); push
@u, $u->unpack; END { print join("\n",@u), "\n" }' | \
sort -nu | ~/bin/codelist > $f.cp
done
where codelist (attached) aggregates an ordered list of integers into a
list of ranges. Some odd bits and pieces came out of this, for instance
some tabs appear in the German po files and should possibly be removed.
I removed tabs and newlines from the lists.
Finally, I ran codecomp to find out which codepoint lists are covered
by DejaVu. This is a script (attached) to check the intersection of two
ranges and to flag if the intersection is the same as one of the ranges,
ie. if that list is completely contained in the other.
The only languages that currently use codepoints that are outside DejaVu's
current range are Greek, Japanese and Chinese. Latin uses two codepoints
outside DejaVu: decimal 958 and 965, although this may be due to garbled
UTF-8 encoding.
I therefore suggest replacing Vera and Bepa-Roman with DejaVu.
Please provide feedback, especially if you can judge the appearance
of the Cyrillic characters in DejaVu compared with the current mix of
Vera/Bepa/FreeSans. We might have to keep FreeSans at present, unless
the Greek translation actually contains some garbled encoding, and the
Cyrillic characters in DejaVu are acceptable. The Greek codepoints in
use are:
32-95,97-126,235,243,252,902,904-905,908,910,913-929,931-935,937,940-943,945-969,972-974
Could someone please also look at the tabs in German and the 958/965
glyphs in Latin.
-- [EMAIL PROTECTED]
#!/usr/bin/perl -n
# list codepoints that are in a font, based on list of codes
# output format is suitable for codepoints="" in Wesnoth fonts.cfg
#push @n, hex;
chomp; push @n, $_;
END {
foreach (sort { $a <=> $b } @n) {
if ($_ == $last + 1) {
$last = $_;
} else {
push @r, ($first == $last) ? "$first" : "$first-$last";
$first = $last = $_;
}
}
push @r, ($first == $last) ? "$first" : "$first-$last";
shift @r; # get rid of blank first element
print join(",", @r), "\n";
}
#!/usr/bin/perl
# compare list of codepoints with a baseline list
while (<>) {
# next unless /codepoints=\"(.*)\"/;
# push @cs, [ split /,/, $1 ];
push @cs, [ split /,/ ];
push @fs, $ARGV;
}
# hardcode DejaVu codepoint list for now, as baseline
@c = split /,/,
'32-126,160-293,296-311,313-328,332-357,360-382,402,452-460,482-483,490-493,536-539,558-559,562-563,567,699,710-711,728-733,786,806,937,960,1024-1119,7808-7813,7922-7923,8208-8213,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710,8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9251,9674,64257-64258';
#foreach $d ( @cs ) {
# print join(',', @$d), "\n";
#}
foreach $d ( @cs ) {
$i = 0; $j = 0;
my @e;
# compare @{$d} and @c, want to find all intersections
while ( $c[$i] and $d->[$j] ) {
($a,$b) = split /-/, $c[$i];
$b = $a unless $b;
($x,$y) = split /-/, $d->[$j];
$y = $x unless $y;
if ( $x <= $b and $a <= $y ) { # intersection
my $min = ($a > $x) ? $a : $x;
my $max = ($b < $y) ? $b : $y;
push @e, $min . (($min != $max) ? "-$max" : '');
}
++$i if $b <= $y;
++$j if $b >= $y;
# if $b == $y advance both
}
push @es, [ @e ];
}
$i = 0;
while ( $es[$i] ) {
# if *equal* is flagged, then this codepoint list is covered by DejaVu
print "*equal* " if join(',', @{$es[$i]}) eq join(',', @{$cs[$i]});
print $fs[$i], ' = ', join(',', @{$es[$i]}), "\n";
++$i;
}