line[strlen(line) - 1] = '\0'; /* Drop \n */
for (lineptr = line + 7; isspace(*lineptr & 255); lineptr ++); /* Skip whitespace */
- if (strcmp(lineptr, "8bit") == 0)
- {
- /*
- * 8-bit text...
- */
-
- UTF8 = 0;
- NumFonts = 0;
-
- /*
- * Read the font description(s)...
- */
-
- while (fgets(line, sizeof(line), fp) != NULL)
- {
- /*
- * Skip comment and blank lines...
- */
-
- if (line[0] == '#' || line[0] == '\n')
- continue;
-
- /*
- * Read the font descriptions that should look like:
- *
- * first last direction width normal [bold italic bold-italic]
- */
-
- lineptr = line;
-
- start = strtol(lineptr, &lineptr, 16);
- end = strtol(lineptr, &lineptr, 16);
-
- while (isspace(*lineptr & 255))
- lineptr ++;
-
- if (!*lineptr)
- break; /* Must be a font mapping */
-
- valptr = lineptr;
-
- while (!isspace(*lineptr & 255) && *lineptr)
- lineptr ++;
-
- if (!*lineptr)
- {
- /*
- * Can't have a font without all required values...
- */
-
- fprintf(stderr, _("ERROR: Bad font description line: %s\n"), valptr);
- fclose(fp);
- exit(1);
- }
-
- *lineptr++ = '\0';
-
- if (strcmp(valptr, "ltor") == 0)
- Directions[NumFonts] = 1;
- else if (strcmp(valptr, "rtol") == 0)
- Directions[NumFonts] = -1;
- else
- {
- fprintf(stderr, _("ERROR: Bad text direction %s\n"), valptr);
- fclose(fp);
- exit(1);
- }
-
- /*
- * Got the direction, now get the width...
- */
-
- while (isspace(*lineptr & 255))
- lineptr ++;
-
- valptr = lineptr;
-
- while (!isspace(*lineptr & 255) && *lineptr)
- lineptr ++;
-
- if (!*lineptr)
- {
- /*
- * Can't have a font without all required values...
- */
-
- fprintf(stderr, _("ERROR: Bad font description line: %s\n"), valptr);
- fclose(fp);
- exit(1);
- }
-
- *lineptr++ = '\0';
-
- if (strcmp(valptr, "single") == 0)
- Widths[NumFonts] = 1;
- else if (strcmp(valptr, "double") == 0)
- Widths[NumFonts] = 2;
- else
- {
- fprintf(stderr, _("ERROR: Bad text width %s\n"), valptr);
- fclose(fp);
- exit(1);
- }
-
- /*
- * Get the fonts...
- */
-
- for (i = 0; *lineptr && i < 4; i ++)
- {
- while (isspace(*lineptr & 255))
- lineptr ++;
-
- valptr = lineptr;
-
- while (!isspace(*lineptr & 255) && *lineptr)
- lineptr ++;
-
- if (*lineptr)
- *lineptr++ = '\0';
-
- if (lineptr > valptr)
- Fonts[NumFonts][i] = strdup(valptr);
- }
-
- /*
- * Fill in remaining fonts as needed...
- */
-
- for (j = i; j < 4; j ++)
- Fonts[NumFonts][j] = strdup(Fonts[NumFonts][0]);
-
- /*
- * Define the character mappings...
- */
-
- for (i = start, j = NumFonts * 256; i <= end; i ++, j ++)
- Chars[i] = j;
-
- NumFonts ++;
- }
-
- /*
- * Read encoding lines...
- */
-
- do
- {
- /*
- * Skip comment and blank lines...
- */
-
- if (line[0] == '#' || line[0] == '\n')
- continue;
-
- /*
- * Grab the character and unicode glyph number.
- */
-
- if (sscanf(line, "%x%x", &ch, &unicode) == 2 && ch < 256)
- Codes[Chars[ch]] = unicode;
- }
- while (fgets(line, sizeof(line), fp) != NULL);
-
- fclose(fp);
- }
- else if (strcmp(lineptr, "utf8") == 0)
+ if (strcmp(lineptr, "utf8") == 0)
{
/*
* UTF-8 (Unicode) text...
*/
- UTF8 = 1;
-
- /*
- * Read the font descriptions...
- */
-
NumFonts = 0;
while (fgets(line, sizeof(line), fp) != NULL)
while (*utf8)
{
- if (*utf8 < 0xc0 || !UTF8)
+ if (*utf8 < 0xc0)
ch = *utf8 ++;
else if ((*utf8 & 0xe0) == 0xc0)
{