42main (
int argc,
char *argv[]) {
47 unsigned char hangul_base[MAX_GLYPHS][32];
48 int initial, medial,
final;
49 unsigned char syllable[32];
65 unsigned char hangul_base[][32],
66 unsigned char *syllable);
74 while (arg_count < argc) {
76 if (strncmp (argv [arg_count],
"-i", 2) == 0) {
78 if (arg_count < argc) {
79 infp = fopen (argv [arg_count],
"r");
81 fprintf (stderr,
"\n*** ERROR: Cannot open %s for input.\n\n",
88 else if (strncmp (argv [arg_count],
"-o", 2) == 0) {
90 if (arg_count < argc) {
91 outfp = fopen (argv [arg_count],
"w");
93 fprintf (stderr,
"\n*** ERROR: Cannot open %s for output.\n\n",
100 else if (strncmp (argv [arg_count],
"-h", 2) == 0 ||
101 strncmp (argv [arg_count],
"--help", 6) == 0) {
114 for (codept = 0; codept < MAX_GLYPHS; codept++) {
115 for (i = 0; i < 32; i++) hangul_base[codept][i] = 0;
125 if (max_codept > 0x8FF) {
126 fprintf (stderr,
"\nWARNING: Hangul glyph range exceeds PUA space.\n\n");
134 for (codept = 0xAC00; codept < 0xAC00 + 19 * 21 * 28; codept++) {
139 fprintf (outfp,
"%04X:", codept);
141 for (i = 0; i < 32; i++) {
142 fprintf (outfp,
"%02X", syllable[i]);
157 printf (
"\ngen-hangul [options]\n\n");
158 printf (
" Generates Hangul syllables from an input Unifont .hex file encoded\n");
159 printf (
" in Johab 6/3/1 format. The output is the Unicode Hangul Syllables\n");
160 printf (
" range, U+AC00..U+D7A3.\n\n");
161 printf (
" This program demonstrates forming Hangul syllables without shifting\n");
162 printf (
" the final consonant (jongseong) when combined with a vowel having\n");
163 printf (
" a long double vertical stroke. For a program that demonstrtes\n");
164 printf (
" shifting jongseong in those cases, see unigen-hangul, which is what\n");
165 printf (
" creates the Unifont Hangul Syllables block.\n\n");
167 printf (
" This program may be invoked with the following command line options:\n\n");
169 printf (
" Option Parameters Function\n");
170 printf (
" ------ ---------- --------\n");
171 printf (
" -h, --help Print this message and exit.\n\n");
172 printf (
" -i input_file Unifont hangul-base.hex formatted input file.\n\n");
173 printf (
" -o output_file Unifont .hex format output file.\n\n");
174 printf (
" Example:\n\n");
175 printf (
" johab2syllables -i hangul-base.hex -o hangul-syllables.hex\n\n");
Define constants and function prototypes for using Hangul glyphs.
unsigned hangul_read_base8(FILE *infp, unsigned char base[][32])
Read hangul-base.hex file into a unsigned char array.
void hangul_decompose(unsigned codept, int *initial, int *medial, int *final)
Decompose a Hangul Syllables code point into three letters.
void hangul_syllable(int choseong, int jungseong, int jongseong, unsigned char hangul_base[][32], unsigned char *syllable)
Given letters in a Hangul syllable, return a glyph.
void print_help(void)
Print a help message.
int main(void)
The main function.