mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
convttf: Allow default glyph to be specified
Formerly fixed at the first glpyh in the converted font; now it can be explicitly set. This mirrors the functionality available from using the DEFAULT_CHAR property of BDF fonts Change-Id: Ibd754faff3fd4d393c4781e8faa685612e3301f0
This commit is contained in:
parent
35270d08e9
commit
e1534d8065
1 changed files with 22 additions and 6 deletions
|
|
@ -94,6 +94,7 @@ int pct = 0; /* display ttc table if it is not zero. */
|
|||
FT_Long max_char = 0x10FFFF;
|
||||
int pixel_size = 15;
|
||||
FT_Long start_char = 0;
|
||||
FT_Long defaultchar = 0;
|
||||
FT_Long limit_char;
|
||||
FT_Long firstchar = 0;
|
||||
FT_Long lastchar;
|
||||
|
|
@ -192,8 +193,9 @@ void usage(void)
|
|||
" default output-file is: \n"
|
||||
" <font-size>-<internal postscript-name of input-file>.fnt.\n"
|
||||
"Options:\n"
|
||||
" -s N Start output at character encodings >= N\n"
|
||||
" -l N Limit output to character encodings <= N\n"
|
||||
" -s N Start output at character encodings >= N (default is first glyph in font)\n"
|
||||
" -l N Limit output to character encodings <= N (default is last glyph in font)\n"
|
||||
" -D N Default character to use for those not present in font (default is first glyph)\n"
|
||||
" -p N Font size N in pixel (default N=15)\n"
|
||||
" -c N Character separation in pixel.Insert space between lines.\n"
|
||||
" -x Trim glyphs horizontally of nearly empty space\n"
|
||||
|
|
@ -712,7 +714,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
|
|||
if (code <= firstchar)
|
||||
firstchar = code;
|
||||
}
|
||||
export_font.header.defaultchar = firstchar;
|
||||
export_font.header.defaultchar = defaultchar - firstchar;
|
||||
export_font.header.firstchar = firstchar;
|
||||
export_font.header.size = lastchar - firstchar + 1;
|
||||
export_font.header.nbits = idx;
|
||||
|
|
@ -764,11 +766,12 @@ void convttf(char* path, char* destfile, FT_Long face_index)
|
|||
charindex = getcharindex( face, code);
|
||||
if ( !charindex )
|
||||
{
|
||||
FT_Long defchar = defaultchar - firstchar;
|
||||
if ( use_long_offset )
|
||||
export_font.offset_long[code - firstchar] = export_font.offset_long[0];
|
||||
export_font.offset_long[code - firstchar] = export_font.offset_long[defchar];
|
||||
else
|
||||
export_font.offset[code - firstchar] = export_font.offset[0];
|
||||
export_font.width[code - firstchar] = export_font.width[0];
|
||||
export_font.offset[code - firstchar] = export_font.offset[defchar];
|
||||
export_font.width[code - firstchar] = export_font.width[defchar];
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1141,6 +1144,19 @@ void getopts(int *pac, char ***pav)
|
|||
while (*p && *p != ' ')
|
||||
p++;
|
||||
break;
|
||||
case 'D': /* set default char*/
|
||||
if (*p) {
|
||||
start_char = atol(p);
|
||||
while (*p && *p != ' ')
|
||||
p++;
|
||||
}
|
||||
else {
|
||||
av++; ac--;
|
||||
if (ac > 0)
|
||||
defaultchar = atol(av[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
trimming = 1;
|
||||
while (*p && *p != ' ')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue