unigencircles - Superimpose dashed combining circles on combining glyphs
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
Go to the source code of this file.
|
#define | MAXSTRING 256 |
| Maximum input line length - 1.
|
|
|
int | main (int argc, char **argv) |
| The main function. More...
|
|
void | add_single_circle (char *glyphstring) |
| Superimpose a single-width dashed combining circle on a glyph bitmap. More...
|
|
void | add_double_circle (char *glyphstring, int offset) |
| Superimpose a double-width dashed combining circle on a glyph bitmap. More...
|
|
unigencircles - Superimpose dashed combining circles on combining glyphs
- Author
- Paul Hardy
- Copyright
- Copyright (C) 2013, Paul Hardy.
Definition in file unigencircles.c.
◆ add_double_circle()
void add_double_circle |
( |
char * |
glyphstring, |
|
|
int |
offset |
|
) |
| |
Superimpose a double-width dashed combining circle on a glyph bitmap.
- Parameters
-
[in,out] | glyphstring | A double-width glyph, 16x16 pixels. |
Definition at line 221 of file unigencircles.c.
229 char circle08[64]={0x0,0x0,0x0,0x0,
248 char circle16[64]={0x0,0x0,0x0,0x0,
276 circle = (offset >= -8) ? circle08 : circle16;
279 for (i = 0; i < 64; i++) {
280 glyphstring[i] = toupper (glyphstring[i]);
283 digit1 = (glyphstring[i] <=
'9') ?
284 (glyphstring[i] -
'0') : (glyphstring[i] -
'A' + 0xA);
287 digit2 = digit1 | circle[i];
290 newstring[i] = (digit2 <= 9) ?
291 (
'0' + digit2) : (
'A' + digit2 - 0xA);
295 newstring[i++] =
'\n';
296 newstring[i++] =
'\0';
298 memcpy (glyphstring, newstring, i);
◆ add_single_circle()
void add_single_circle |
( |
char * |
glyphstring | ) |
|
Superimpose a single-width dashed combining circle on a glyph bitmap.
- Parameters
-
[in,out] | glyphstring | A single-width glyph, 8x16 pixels. |
Definition at line 163 of file unigencircles.c.
168 char circle[32]={0x0,0x0,
190 for (i = 0; i < 32; i++) {
191 glyphstring[i] = toupper (glyphstring[i]);
194 digit1 = (glyphstring[i] <=
'9') ?
195 (glyphstring[i] -
'0') : (glyphstring[i] -
'A' + 0xA);
198 digit2 = digit1 | circle[i];
201 newstring[i] = (digit2 <= 9) ?
202 (
'0' + digit2) : (
'A' + digit2 - 0xA);
206 newstring[i++] =
'\n';
207 newstring[i++] =
'\0';
209 memcpy (glyphstring, newstring, i);
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
The main function.
- Parameters
-
[in] | argc | The count of command line arguments. |
[in] | argv | Pointer to array of command line arguments. |
- Returns
- This program exits with status EXIT_SUCCESS.
Definition at line 73 of file unigencircles.c.
81 char combining[0x110000];
82 char x_offset [0x110000];
101 memset (combining, 0, 0x110000 *
sizeof (
char));
102 memset (x_offset , 0, 0x110000 *
sizeof (
char));
104 if ((infilefp = fopen (argv[1],
"r")) == NULL) {
105 fprintf (stderr,
"ERROR - combining characters file %s not found.\n\n",
111 while (fscanf (infilefp,
"%X:%d", &loc, &offset) != EOF) {
118 if (loc != 0x01107F && loc != 0x01D1A0) {
120 x_offset [loc] = offset;
126 if ((infilefp = fopen (argv[2],
"r")) == NULL) {
127 fprintf (stderr,
"ERROR - nonprinting characters file %s not found.\n\n",
133 while (fscanf (infilefp,
"%X:%*s", &loc) != EOF) combining[loc] = 0;
141 while (fgets (teststring,
MAXSTRING-1, stdin) != NULL) {
142 sscanf (teststring,
"%X", &loc);
143 gstart = strchr (teststring,
':') + 1;
144 if (combining[loc]) {
145 if (strlen (gstart) < 35)
150 printf (
"%s", teststring);