summaryrefslogtreecommitdiffstats
path: root/layout/reftests/fonts/generate-bitpattern-font.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /layout/reftests/fonts/generate-bitpattern-font.pl
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/reftests/fonts/generate-bitpattern-font.pl')
-rw-r--r--layout/reftests/fonts/generate-bitpattern-font.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/layout/reftests/fonts/generate-bitpattern-font.pl b/layout/reftests/fonts/generate-bitpattern-font.pl
new file mode 100644
index 0000000000..d47ff4541f
--- /dev/null
+++ b/layout/reftests/fonts/generate-bitpattern-font.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+
+# Generates an SVG Font where each glyph (identified on stdin by four
+# hex characters) consists of a bit pattern representing the Unicode
+# code point it is the glyph for.
+
+use strict;
+
+print <<EOF;
+<svg xmlns="http://www.w3.org/2000/svg">
+<font id="BitPattern" horiz-adv-x="1000">
+ <font-face font-family="BitPattern" units-per-em="1000" ascent="800"/>
+EOF
+
+while (<>) {
+ chomp;
+ next if /^\s*$/;
+ die unless /^[0-9A-Fa-f]{4}$/;
+ my $c = hex;
+ my $s = " <glyph unicode='&#x$_;' d='";
+ for (my $i = 0; $i < 32; $i++) {
+ if ($c & (1 << $i)) {
+ my $x = 100 * (7 - ($i % 8));
+ my $y = 100 * int($i / 8);
+ $s .= "M$x,$y v80h80v-80z ";
+ }
+ }
+ $s .= "'/>\n";
+ print $s;
+}
+
+print <<EOF;
+</font>
+</svg>
+EOF