@@ -51,7 +51,7 @@ void enbit(uint8_t value) {
51
51
}
52
52
53
53
int main (int argc , char * argv []) {
54
- int i , j , err , size , first = ' ' , last = '~' , bitmapOffset = 0 , x , y , byte ;
54
+ int i , j , err , size , fpt , first = ' ' , last = '~' , bitmapOffset = 0 , x , y , byte ;
55
55
char * fontName , c , * ptr ;
56
56
FT_Library library ;
57
57
FT_Face face ;
@@ -65,6 +65,7 @@ int main(int argc, char *argv[]) {
65
65
// fontconvert [filename] [size]
66
66
// fontconvert [filename] [size] [last char]
67
67
// fontconvert [filename] [size] [first char] [last char]
68
+ // Fractional points (1/64 pt) are used if size ends with 'f'
68
69
// Unless overridden, default first and last chars are
69
70
// ' ' (space) and '~', respectively
70
71
@@ -74,6 +75,7 @@ int main(int argc, char *argv[]) {
74
75
}
75
76
76
77
size = atoi (argv [2 ]);
78
+ fpt = argv [2 ][strlen (argv [2 ]) - 1 ] == 'f' ;
77
79
78
80
if (argc == 4 ) {
79
81
last = atoi (argv [3 ]);
@@ -109,7 +111,7 @@ int main(int argc, char *argv[]) {
109
111
ptr = & fontName [strlen (fontName )]; // If none, append
110
112
// Insert font size and 7/8 bit. fontName was alloc'd w/extra
111
113
// space to allow this, we're not sprintfing into Forbidden Zone.
112
- sprintf (ptr , "%dpt% db" , size , (last > 127 ) ? 8 : 7 );
114
+ sprintf (ptr , "%d%spt% db" , size , fpt ? "f" : "" , (last > 127 ) ? 8 : 7 );
113
115
// Space and punctuation chars in name replaced w/ underscores.
114
116
for (i = 0 ; (c = fontName [i ]); i ++ ) {
115
117
if (isspace (c ) || ispunct (c ))
@@ -137,7 +139,7 @@ int main(int argc, char *argv[]) {
137
139
}
138
140
139
141
// << 6 because '26dot6' fixed-point format
140
- FT_Set_Char_Size (face , size << 6 , 0 , DPI , 0 );
142
+ FT_Set_Char_Size (face , fpt ? size : size << 6 , 0 , DPI , 0 );
141
143
142
144
// Currently all symbols from 'first' to 'last' are processed.
143
145
// Fonts may contain WAY more glyphs than that, but this code
0 commit comments