GNU Unifont  15.1.01
Pan-Unicode font with complete Unicode Plane 0 coverage and partial coverage of higher planes
unijohab2html.c File Reference

Display overalpped Hangul letter combinations in a grid. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hangul.h"
Include dependency graph for unijohab2html.c:

Go to the source code of this file.

Macros

#define MAXFILENAME   1024
 
#define START_JUNG   0
 Vowel index of first vowel with which to begin.
 
#define RED   0xCC0000
 Color code for slightly unsaturated HTML red.
 
#define GREEN   0x00CC00
 Color code for slightly unsaturated HTML green.
 
#define BLUE   0x0000CC
 Color code for slightly unsaturated HTML blue.
 
#define BLACK   0x000000
 Color code for HTML black.
 
#define WHITE   0xFFFFFF
 Color code for HTML white.
 

Functions

int main (int argc, char *argv[])
 The main function.
 
void parse_args (int argc, char *argv[], int *inindex, int *outindex, int *modern_only)
 Parse command line arguments. More...
 

Detailed Description

Display overalpped Hangul letter combinations in a grid.

This displays overlapped letters that form Unicode Hangul Syllables combinations, as a tool to determine bounding boxes for all combinations. It works with both modern and archaic Hangul letters.

Input is a Unifont .hex file such as the "hangul-base.hex" file that is part of the Unifont package. Glyphs are all processed as being 16 pixels wide and 16 pixels tall.

Output is an HTML file containing 16 by 16 pixel grids shwoing overlaps in table format, arranged by variation of the initial consonant (choseong).

Initial consonants (choseong) have 6 variations. In general, the first three are for combining with vowels (jungseong) that are vertical, horizontal, or vertical and horizontal, respectively; the second set of three variations are for combinations with a final consonant.

The output HTML file can be viewed in a web browser.

Author
Paul Hardy

Definition in file unijohab2html.c.

Function Documentation

◆ parse_args()

void parse_args ( int  argc,
char *  argv[],
int *  inindex,
int *  outindex,
int *  modern_only 
)

Parse command line arguments.

Parameters
[in]argcThe argc parameter to the main function.
[in]argvThe argv command line arguments to the main function.
[in,out]infileThe input filename; defaults to NULL.
[in,out]outfileThe output filename; defaults to NULL.

Definition at line 608 of file unijohab2html.c.

609  {
610  int arg_count; /* Current index into argv[]. */
611 
612  int strncmp (const char *s1, const char *s2, size_t n);
613 
614 
615  arg_count = 1;
616 
617  while (arg_count < argc) {
618  /* If input file is specified, open it for read access. */
619  if (strncmp (argv [arg_count], "-i", 2) == 0) {
620  arg_count++;
621  if (arg_count < argc) {
622  *inindex = arg_count;
623  }
624  }
625  /* If only modern Hangul is desired, set modern_only flag. */
626  else if (strncmp (argv [arg_count], "-m", 2) == 0 ||
627  strncmp (argv [arg_count], "--modern", 8) == 0) {
628  *modern_only = 1;
629  }
630  /* If output file is specified, open it for write access. */
631  else if (strncmp (argv [arg_count], "-o", 2) == 0) {
632  arg_count++;
633  if (arg_count < argc) {
634  *outindex = arg_count;
635  }
636  }
637  /* If help is requested, print help message and exit. */
638  else if (strncmp (argv [arg_count], "-h", 2) == 0 ||
639  strncmp (argv [arg_count], "--help", 6) == 0) {
640  printf ("\nunijohab2html [options]\n\n");
641  printf (" Generates an HTML page of overlapping Hangul letters from an input\n");
642  printf (" Unifont .hex file encoded in Johab 6/3/1 format.\n\n");
643 
644  printf (" Option Parameters Function\n");
645  printf (" ------ ---------- --------\n");
646  printf (" -h, --help Print this message and exit.\n\n");
647  printf (" -i input_file Unifont hangul-base.hex formatted input file.\n\n");
648  printf (" -o output_file HTML output file showing overlapping letters.\n\n");
649  printf (" -m, --modern Only examine modern Hangul letters.\n\n");
650  printf (" Example:\n\n");
651  printf (" unijohab2html -i hangul-base.hex -o hangul-syllables.html\n\n");
652 
653  exit (EXIT_SUCCESS);
654  }
655 
656  arg_count++;
657  }
658 
659  return;
660 }