aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/xface2xbm.in
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-03-13 17:04:56 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-03-13 17:04:56 +0000
commitb118dd18d3e0b3829e6814af684e30d683b7e67d (patch)
tree2bc798345dccf998435a18c7d3ce6caf1c9a2e79 /scripts/xface2xbm.in
parent[w3m-dev 03126] reshapeBuffer() and -m option (diff)
downloadw3m-b118dd18d3e0b3829e6814af684e30d683b7e67d.tar.gz
w3m-b118dd18d3e0b3829e6814af684e30d683b7e67d.zip
[w3m-dev 03127] X-Face
* NEWS: X-Face support * configure (use_xface): added * config.h.dist (USE_XFACE): added (XFACE2XBM): added * file.c (xface2xbm): added (readHeader): X-Face: handling * scripts/Makefile (LIB_TARGETS): add xface2xbm * scripts/xface2xbm.in: added From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--scripts/xface2xbm.in54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/xface2xbm.in b/scripts/xface2xbm.in
new file mode 100644
index 0000000..2c2002a
--- /dev/null
+++ b/scripts/xface2xbm.in
@@ -0,0 +1,54 @@
+#!@PERL@
+
+# See http://www.lab3.kuis.kyoto-u.ac.jp/~tsumura/emacs/x-face.html
+$UNCOMPFACE = "uncompface";
+
+$xf = "";
+while(<>) {
+# s/^X-Face://i if ($xf eq "");
+ $xf .= $_;
+}
+
+pipe(R, W2);
+pipe(R2, W);
+if (! fork()) {
+ close(R);
+ close(W);
+ open(STDIN, "<&R2");
+ open(STDOUT, ">&W2");
+ exec $UNCOMPFACE;
+ die;
+}
+close(R2);
+close(W2);
+print W $xf;
+close(W);
+while(<R>) {
+ while(s/0x(..)(..)//) {
+ push(@bm, hex($1), hex($2));
+ }
+}
+close(R);
+
+$W = 48;
+$H = @bm * 8 / $W; # must be 48
+print <<EOF;
+#define xf_width $W
+#define xf_height $H
+static char xf_bits[] = {
+EOF
+while (@bm) {
+ for (1..6) {
+ $x = shift @bm;
+ $y = 0;
+ for $i (1 .. 8) {
+ $y |= ($x & 1) << (8 - $i);
+ $x >>= 1;
+ }
+ printf " 0x%02X,", $y;
+ }
+ print "\n";
+}
+print <<EOF;
+};
+EOF