diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2015-10-19 16:28:33 +0300 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2015-10-22 02:51:30 +0300 |
commit | 9a2b38e8f5957418362e86b525f72794565deedd (patch) | |
tree | 1f6ba06bcfa866053f369325a5659b193f1dde7e /libass | |
parent | ab6aef6d0766aa1ce801c5b4ca1441a491681489 (diff) | |
download | libass-9a2b38e8f5957418362e86b525f72794565deedd.tar.bz2 libass-9a2b38e8f5957418362e86b525f72794565deedd.tar.xz |
fontselect: read PostScript names for memory fonts
Currently this affects only the verbose output in
ass_font_select, but it will become more useful when we
start matching against PostScript names in the future.
Diffstat (limited to 'libass')
-rw-r--r-- | libass/ass_fontselect.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c index d0d282f8..39d4d5d4 100644 --- a/libass/ass_fontselect.c +++ b/libass/ass_fontselect.c @@ -719,6 +719,7 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info) int slant, weight; char *fullnames[MAX_FULLNAME]; char *families[MAX_FULLNAME]; + char *postscript_name = NULL; // we're only interested in outlines if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) @@ -766,6 +767,10 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info) if (num_family == 0) goto error; + postscript_name = FT_Get_Postscript_Name(face); + if (postscript_name != NULL) + postscript_name = strdup_trimmed(postscript_name); + // calculate sensible slant and weight from style attributes slant = 110 * !!(face->style_flags & FT_STYLE_FLAG_ITALIC); weight = 300 * !!(face->style_flags & FT_STYLE_FLAG_BOLD) + 400; @@ -774,7 +779,8 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info) info->slant = slant; info->weight = weight; info->width = 100; // FIXME, should probably query the OS/2 table - info->families = calloc(sizeof(char *), num_family); + info->postscript_name = postscript_name; + info->families = calloc(sizeof(char *), num_family); if (info->families == NULL) goto error; @@ -801,6 +807,7 @@ error: free(info->families); free(info->fullnames); + free(postscript_name); return 1; } @@ -822,6 +829,7 @@ static void free_font_info(ASS_FontProviderMetaData *meta) free(meta->families); free(meta->fullnames); + free(meta->postscript_name); } /** |