[sfnt] Split off another bit of `sfnt_get_ps_name'.
* src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some functionality into... (search_name_id): ... New function.
This commit is contained in:
parent
c1abd6aa47
commit
b653a23079
@ -1,3 +1,11 @@
|
||||
2017-02-23 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[sfnt] Split off another bit of `sfnt_get_ps_name'.
|
||||
|
||||
* src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some
|
||||
functionality into...
|
||||
(search_name_id): ... New function.
|
||||
|
||||
2017-02-23 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[sfnt] Modularize `sfnt_get_ps_name'.
|
||||
|
@ -306,10 +306,41 @@
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
search_name_id( TT_Face face,
|
||||
FT_Int id,
|
||||
FT_Int *win,
|
||||
FT_Int *apple )
|
||||
{
|
||||
FT_Int n;
|
||||
|
||||
|
||||
*win = -1;
|
||||
*apple = -1;
|
||||
|
||||
for ( n = 0; n < face->num_names; n++ )
|
||||
{
|
||||
TT_Name name = face->name_table.names + n;
|
||||
|
||||
|
||||
if ( name->nameID == id && name->stringLength > 0 )
|
||||
{
|
||||
if ( IS_WIN( name ) )
|
||||
*win = n;
|
||||
|
||||
if ( IS_APPLE( name ) )
|
||||
*apple = n;
|
||||
}
|
||||
}
|
||||
|
||||
return *win || *apple;
|
||||
}
|
||||
|
||||
|
||||
static const char*
|
||||
sfnt_get_ps_name( TT_Face face )
|
||||
{
|
||||
FT_Int n, found_win, found_apple;
|
||||
FT_Int found_win, found_apple;
|
||||
const char* result = NULL;
|
||||
|
||||
|
||||
@ -318,23 +349,7 @@
|
||||
|
||||
/* scan the name table to see whether we have a Postscript name here, */
|
||||
/* either in Macintosh or Windows platform encodings */
|
||||
found_win = -1;
|
||||
found_apple = -1;
|
||||
|
||||
for ( n = 0; n < face->num_names; n++ )
|
||||
{
|
||||
TT_Name name = face->name_table.names + n;
|
||||
|
||||
|
||||
if ( name->nameID == 6 && name->stringLength > 0 )
|
||||
{
|
||||
if ( IS_WIN( name ) )
|
||||
found_win = n;
|
||||
|
||||
if ( IS_APPLE( name ) )
|
||||
found_apple = n;
|
||||
}
|
||||
}
|
||||
search_name_id( face, 6, &found_win, &found_apple );
|
||||
|
||||
/* prefer Windows entries over Apple */
|
||||
if ( found_win != -1 )
|
||||
|
Loading…
Reference in New Issue
Block a user