1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/fonts/generate-bitpattern-font.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +#!/usr/bin/perl -w 1.5 + 1.6 +# Generates an SVG Font where each glyph (identified on stdin by four 1.7 +# hex characters) consists of a bit pattern representing the Unicode 1.8 +# code point it is the glyph for. 1.9 + 1.10 +use strict; 1.11 + 1.12 +print <<EOF; 1.13 +<svg xmlns="http://www.w3.org/2000/svg"> 1.14 +<font id="BitPattern" horiz-adv-x="1000"> 1.15 + <font-face font-family="BitPattern" units-per-em="1000" ascent="800"/> 1.16 +EOF 1.17 + 1.18 +while (<>) { 1.19 + chomp; 1.20 + next if /^\s*$/; 1.21 + die unless /^[0-9A-Fa-f]{4}$/; 1.22 + my $c = hex; 1.23 + my $s = " <glyph unicode='&#x$_;' d='"; 1.24 + for (my $i = 0; $i < 32; $i++) { 1.25 + if ($c & (1 << $i)) { 1.26 + my $x = 100 * (7 - ($i % 8)); 1.27 + my $y = 100 * int($i / 8); 1.28 + $s .= "M$x,$y v80h80v-80z "; 1.29 + } 1.30 + } 1.31 + $s .= "'/>\n"; 1.32 + print $s; 1.33 +} 1.34 + 1.35 +print <<EOF; 1.36 +</font> 1.37 +</svg> 1.38 +EOF