/usr/bin/hex2sfd is in unifont-bin 1:6.3.20131221-1.
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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | #!/usr/bin/perl
#
# Copyright (C) 2005 Luis Gonzalez Miranda
#
# hex2sfd created in 2005 by Luis Gonzalez Miranda, http://www.lgm.cl
#
# LICENSE:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# %combining = ();
# open(A, "<combining.txt");
# while(<A>) {
# chomp;
# $combining{$A} = 1;
# }
# close(A);
#
# Modified by Paul Hardy, June 2008.
#
# The original code above 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.txt");
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;
# if($combining{$c}) { # this was the original "if"
if ($combining[ hex($c) ]) {
$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;
$y1=$y * $pixel - $descent;
$x2=$x1 + $pixel;
$y2=$y1 + $pixel;
}
$prev=1;
} else {
if($prev) {
$x2=$x * $pixel + $pixel;
print << "END";
$x1 $y1 m $bitmask
$x1 $y2 l $bitmask
$x2 $y2 l $bitmask
$x2 $y1 l $bitmask
$x1 $y1 l $bitmask
END
}
$prev=0;
}
$num=int($num/2);
}
if($prev) {
$x2=0;
print << "END";
$x1 $y1 m $bitmask
$x1 $y2 l $bitmask
$x2 $y2 l $bitmask
$x2 $y1 l $bitmask
$x1 $y1 l $bitmask
END
}
}
print << "END";
EndSplineSet
EndChar
END
$count++;
}
print << "END";
EndChars
EndSplineFont
END
|