unibdf2hex - Convert a BDF file into a unifont.hex file
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
#define | UNISTART 0x3400 |
| First Unicode code point to examine.
|
|
#define | UNISTOP 0x4DBF |
| Last Unicode code point to examine.
|
|
#define | MAXBUF 256 |
| Maximum allowable input file line length - 1.
|
|
unibdf2hex - Convert a BDF file into a unifont.hex file
- Author
- Paul Hardy, January 2008
- Copyright
- Copyright (C) 2008, 2013 Paul Hardy
Note: currently this has hard-coded code points for glyphs extracted from Wen Quan Yi to create the Unifont source file "wqy.hex".
Definition in file unibdf2hex.c.
◆ main()
The main function.
- Returns
- Exit status is always 0 (successful termination).
Definition at line 46 of file unibdf2hex.c.
52 int bbxx, bbxy, bbxxoff, bbxyoff;
58 while (fgets (inbuf,
MAXBUF - 1, stdin) != NULL) {
59 if (strncmp (inbuf,
"ENCODING ", 9) == 0) {
60 sscanf (&inbuf[9],
"%d", &thispoint);
65 if ((thispoint >= 0x2E80 && thispoint <= 0x2EFF) ||
66 (thispoint >= 0x2F00 && thispoint <= 0x2FDF) ||
67 (thispoint >= 0x2FF0 && thispoint <= 0x2FFF) ||
68 (thispoint >= 0x3001 && thispoint <= 0x303F) ||
69 (thispoint >= 0x3100 && thispoint <= 0x312F) ||
70 (thispoint >= 0x31A0 && thispoint <= 0x31BF) ||
71 (thispoint >= 0x31C0 && thispoint <= 0x31EF) ||
72 (thispoint >= 0x3400 && thispoint <= 0x4DBF) ||
73 (thispoint >= 0x4E00 && thispoint <= 0x9FCF) ||
74 (thispoint >= 0xF900 && thispoint <= 0xFAFF))
76 while (fgets (inbuf,
MAXBUF - 1, stdin) != NULL &&
77 strncmp (inbuf,
"BBX ", 4) != 0);
79 sscanf (&inbuf[4],
"%d %d %d %d", &bbxx, &bbxy, &bbxxoff, &bbxyoff);
80 while (fgets (inbuf,
MAXBUF - 1, stdin) != NULL &&
81 strncmp (inbuf,
"BITMAP", 6) != 0);
82 fprintf (stdout,
"%04X:", thispoint);
85 startrow = descent + bbxyoff + bbxy;
88 for (i = 16; i > startrow; i--) {
89 fprintf (stdout,
"0000");
92 while (fgets (inbuf,
MAXBUF - 1, stdin) != NULL &&
93 strncmp (inbuf,
"END", 3) != 0) {
94 sscanf (inbuf,
"%X", &rowout);
96 if (bbxx <= 8) rowout <<= 8;
98 fprintf (stdout,
"%04X", rowout);
103 while (digitsout < 64) {
104 fprintf (stdout,
"0000");
107 fprintf (stdout,
"\n");
#define MAXBUF
Maximum allowable input file line length - 1.