/usr/bin/hex2sfd is in unifont-bin 1:5.1.20080914-1.1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #!/usr/bin/perl
#
# hex2sfd created in 2005 by Luis Gonzalez Miranda, http://www.lgm.cl
#
# Modified by Paul Hardy, June 2008.
#
# The original combining mark code didn't work properly. The replacement code
# below wastes RAM, but it works as a quick fix.
#
@combining = ();
for ($i = 0; $i < 65536; $i++) {
push(@combining, 0);
}
open(A, "<combining.dat");
while (<A>) {
chomp;
$combining[ hex($_) ] = 1;
}
close(A);
#
# Modified by Paul Hardy, July 2008.
#
# Make pixel 64 units for greatest scale; floating point numbers in
# TrueType have 6 fractional bits, so this works out well (2^6 = 64).
# Also, make size of font a power of 2 (16 * 64) for efficient scaling
# to any point size in TrueType. Made bitmask a variable for easy
# experimenting.
#
$pixel = 64;
$descent = 2 * $pixel;
$ascent = 16 * $pixel - $descent;
# $bitmask = 25; # round in x (doesn't really work), corner point selected
print << "END";
SplineFontDB: 1.0
FontName: unifont
FullName: GNU Unifont
FamilyName: unifont
Weight: Medium
Comments: Created from the 2008-07-06 version of the GNU Unifont
Comments: with Luis Gonzalez Miranda's Perl and FontForge scripts.
Comments: See http://www.lgm.cl/trabajos/unifont/index.en.html for
Comments: information on Luis' scripts.
Comments: See http://czyborra.com/unifont
Comments: and http://unifoundry.com/unifont.html
Comments: for information on GNU Unifont.
Comments: See http://fontforge.sf.net for information on FontForge.
Version: 1.00
ItalicAngle: 0
UnderlinePosition: -100
UnderlineWidth: 40
Ascent: $ascent
Descent: $descent
NeedsXUIDChange: 1
XUID: [1021 140 1293607838 5610107]
FSType: 0
PfmFamily: 33
TTFWeight: 500
TTFWidth: 5
Panose: 2 0 6 4 0 0 0 0 0 0
LineGap: 72
VLineGap: 0
OS2WinAscent: 0
OS2WinAOffset: 1
OS2WinDescent: 0
OS2WinDOffset: 1
HheadAscent: 0
HheadAOffset: 1
HheadDescent: 0
HheadDOffset: 1
ScriptLang: 1
1 latn 1 dflt
Encoding: UnicodeBmp
UnicodeInterp: none
DisplaySize: -24
AntiAlias: 1
FitToEm: 1
WinInfo: 0 50 22
TeXData: 1 0 0 346030 173015 115343 0 1048576 115343 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
BeginChars: 65536 3
END
$count=0;
while(<STDIN>) {
chomp;
($c,$d)=split(/:/);
$width=length($d)/4;
$ptwidth=$pixel * $width;
$xoffset = 0; # assume this isn't a combining mark
# if($combining{$c}) { # this was the original "if"
if ($combining[ hex($c) ]) { # this code point is a combining mark
$xoffset = -$ptwidth; # we'll go left by this amount
$ptwidth = 0;
}
$cn=hex($c);
# Changed "Flags: H" to "Flags: HW" to fix spaces - Paul Hardy, 2008
print << "END";
StartChar: $c
Encoding: $cn $cn $count
Width: $ptwidth
Flags: HW
TeX: 0 0 0 0
Fore
END
for($i=0;$i<16;$i++) {
$l=substr($d, $i*$width/4, $width/4);
$num=hex($l);
$prev=0;
for($j=0; $j<$width; $j++) {
$x=$width - 1 - $j;
$y=15 - $i;
if($num%2) {
# point at i, width-1-j
if(!$prev) {
$x1=$x * $pixel + $pixel;
$x1 += $xoffset;
$y1=$y * $pixel - $descent;
$x2=$x1 + $pixel;
$x2 += $xoffset;
$y2=$y1 + $pixel;
}
$prev=1;
} else {
if($prev) {
$x2=$x * $pixel + $pixel;
$x2 += $xoffset;
print << "END";
$x1 $y1 m 29
$x1 $y2 l 25
$x2 $y2 l 25
$x2 $y1 l 25
$x1 $y1 l 29
END
}
$prev=0;
}
$num=int($num/2);
}
if($prev) {
$x2 = $xoffset;
print << "END";
$x1 $y1 m 29
$x1 $y2 l 25
$x2 $y2 l 25
$x2 $y1 l 25
$x1 $y1 l 29
END
}
}
print << "END";
EndSplineSet
EndChar
END
$count++;
}
print << "END";
EndChars
EndSplineFont
END
|