git.shiar.nl
/
unifont.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
50c16a5
)
unibdf2hex: count lines not glyphs
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 16 Jul 2015 06:18:57 +0000
(08:18 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 16 Jul 2015 08:10:38 +0000
(10:10 +0200)
src/unibdf2hex.c
patch
|
blob
|
history
diff --git
a/src/unibdf2hex.c
b/src/unibdf2hex.c
index bec84951308c0fe3bac20881ede3eb6596c63abd..bbd4dc1def37ab1848d714d488dfc51b0efb5a4b 100644
(file)
--- a/
src/unibdf2hex.c
+++ b/
src/unibdf2hex.c
@@
-35,13
+35,14
@@
int
main()
{
int i;
main()
{
int i;
- int
digitsout; /* how many hex digits we output in a
bitmap */
+ int
rownum; /* number of lines we output in
bitmap */
int thispoint;
char inbuf[MAXBUF];
int bbxx, bbxy, bbxxoff, bbxyoff;
int thispoint;
char inbuf[MAXBUF];
int bbxx, bbxy, bbxxoff, bbxyoff;
- int descent=
4
; /* font descent wrt baseline */
+ int descent=
2
; /* font descent wrt baseline */
int startrow; /* row to start glyph */
int startrow; /* row to start glyph */
+ int rowlen=4; /* number of digits per row */
unsigned rowout;
while (fgets (inbuf, MAXBUF - 1, stdin)) {
unsigned rowout;
while (fgets (inbuf, MAXBUF - 1, stdin)) {
@@
-60,14
+61,14
@@
main()
}
fprintf (stdout, "%04X:", thispoint);
}
fprintf (stdout, "%04X:", thispoint);
-
digitsout
= 0;
+
rownum
= 0;
/* Print initial blank rows */
startrow = descent + bbxyoff + bbxy;
/* Force everything to 16 pixels wide */
for (i = 16; i > startrow; i--) {
/* Print initial blank rows */
startrow = descent + bbxyoff + bbxy;
/* Force everything to 16 pixels wide */
for (i = 16; i > startrow; i--) {
- fprintf (stdout,
"0000"
);
-
digitsout += 4
;
+ fprintf (stdout,
"%0*d", rowlen, 0
);
+
rownum++
;
}
/* Copy bitmap until END */
while (fgets (inbuf, MAXBUF - 1, stdin)) {
}
/* Copy bitmap until END */
while (fgets (inbuf, MAXBUF - 1, stdin)) {
@@
-76,14
+77,14
@@
main()
/* Now force glyph to a 16x16 grid even if they'd fit in 8x16 */
if (bbxx <= 8) rowout <<= 8; /* shift left for 16x16 glyph */
rowout >>= bbxxoff;
/* Now force glyph to a 16x16 grid even if they'd fit in 8x16 */
if (bbxx <= 8) rowout <<= 8; /* shift left for 16x16 glyph */
rowout >>= bbxxoff;
- fprintf (stdout, "%0
4X"
, rowout);
-
digitsout += 4
;
+ fprintf (stdout, "%0
*X", rowlen
, rowout);
+
rownum++
;
}
}
- /* Pad
for 16x16 glyph
*/
- while (
digitsout < 64
) {
- fprintf (stdout,
"0000"
);
-
digitsout += 4
;
+ /* Pad
empty lines until glyph has sufficient height
*/
+ while (
rownum < 16
) {
+ fprintf (stdout,
"%0*d", rowlen, 0
);
+
rownum++
;
}
fprintf (stdout,"\n");
}
}
fprintf (stdout,"\n");
}