RELEASE/1.2
debug-ci
debug-ci-sanitisers
faster-cavernlog
log-select
main
stereo
stereo-2025
walls-data
walls-data-hanging-as-warning
warn-only-for-hanging-survey
|
Last change
on this file since 1aa3fb7 was 1aa3fb7, checked in by Olly Betts <olly@…>, 15 years ago |
|
Makefile.am,buildmacosx.sh,lib/Makefile.am,lib/afm2txf.pl,
lib/make-pixel-font,src/: Replace the textured-mapped font drawing
with an approach based on glBitmap. This doesn't suffer from the
character alignment issues which the textured-mapped fonts had,
and is actually significantly faster on some machines. The current
font used is (mostly) fixed-width, but this isn't an inherent
limitation - it was just the easiest font data to convert to a
usable format.
git-svn-id: file:///home/survex-svn/survex/trunk@3842 4b37db11-9a0c-4f06-9ece-9ab7cdaee568
|
-
Property mode
set to
100755
|
|
File size:
1.6 KB
|
| Line | |
|---|
| 1 | #!/usr/bin/perl
|
|---|
| 2 | use warnings;
|
|---|
| 3 | use strict;
|
|---|
| 4 |
|
|---|
| 5 | my %bitno = (0 => 0);
|
|---|
| 6 | for (0 .. 31) {
|
|---|
| 7 | $bitno{1 << $_} = $_;
|
|---|
| 8 | }
|
|---|
| 9 |
|
|---|
| 10 | my $last_ch = -1;
|
|---|
| 11 | open U, '<', '/usr/share/unifont/unifont.hex' or die $!;
|
|---|
| 12 | open O, '>', 'unifont.pixelfont' or die $!;
|
|---|
| 13 | while (<U>) {
|
|---|
| 14 | my ($ch, $hex) = /^([[:xdigit:]]+):([[:xdigit:]]+)$/;
|
|---|
| 15 | if (!defined $ch) {
|
|---|
| 16 | print "Bad line: $_";
|
|---|
| 17 | next;
|
|---|
| 18 | }
|
|---|
| 19 | $ch = hex($ch);
|
|---|
| 20 | # print "$ch:\n";
|
|---|
| 21 |
|
|---|
| 22 | while (++$last_ch < $ch) {
|
|---|
| 23 | # print "Missing entry for ".($last_ch - 1 )."\n";
|
|---|
| 24 | print O pack 'C', 0x00;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | # $len is 0, 2 or 4
|
|---|
| 28 | my $len = length($hex) / 16;
|
|---|
| 29 | my $packcode;
|
|---|
| 30 | if ($len == 4) {
|
|---|
| 31 | $packcode = 'S';
|
|---|
| 32 | } elsif ($len == 2) {
|
|---|
| 33 | $packcode = 'C';
|
|---|
| 34 | } elsif ($len == 0) {
|
|---|
| 35 | $packcode = '';
|
|---|
| 36 | } else {
|
|---|
| 37 | die "No handling for len = $len\n";
|
|---|
| 38 | }
|
|---|
| 39 | my $data = '';
|
|---|
| 40 | my $start;
|
|---|
| 41 | my $n = 0;
|
|---|
| 42 | if ($len) {
|
|---|
| 43 | for (0 .. 15) {
|
|---|
| 44 | my $c = substr($hex, (15 - $_) * $len, $len);
|
|---|
| 45 | my $row = hex($c);
|
|---|
| 46 | if (!defined $start) {
|
|---|
| 47 | # Skip blank rows at the bottom.
|
|---|
| 48 | next unless $row;
|
|---|
| 49 | $start = $_;
|
|---|
| 50 | }
|
|---|
| 51 | $n = $_ if $row;
|
|---|
| 52 | $data .= pack $packcode, $row;
|
|---|
| 53 |
|
|---|
| 54 | # my $b = sprintf $fmt, $row;
|
|---|
| 55 | # $b =~ y/01/ @/;
|
|---|
| 56 | # print "\t$b\n";
|
|---|
| 57 | }
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | if (!defined $start) {
|
|---|
| 61 | # No set pixels.
|
|---|
| 62 | print O pack 'C', 0x00;
|
|---|
| 63 | die "not really empty!" unless $hex =~ /^0*$/;
|
|---|
| 64 | } else {
|
|---|
| 65 | die "really empty!" if $hex =~ /^0*$/;
|
|---|
| 66 | $n = $n + 1 - $start;
|
|---|
| 67 | print O pack 'C', $len / 2;
|
|---|
| 68 | print O pack 'C', ($start << 4) | ($n - 1);
|
|---|
| 69 | die "too little data (".length($data)." < ".$n."*".($len/2).")" if length($data) < $n * $len/2;
|
|---|
| 70 | print O substr($data, 0, $n * $len / 2);
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | close O or die $!;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.