diff options
author | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-26 20:53:29 +0000 |
---|---|---|
committer | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-26 20:53:29 +0000 |
commit | 4d27dbd5c957246ec52b59f93e34830bd8b00466 (patch) | |
tree | 69ef0069c6afa4324113456fa974e8072e96c0dd /libass/ass_cache.c | |
parent | 004c19b5201cc4460c085096c93f0ccefc6222a3 (diff) | |
download | mpv-4d27dbd5c957246ec52b59f93e34830bd8b00466.tar.bz2 mpv-4d27dbd5c957246ec52b59f93e34830bd8b00466.tar.xz |
Make ass_new_font return ass_font_t struct (instead of just FT_Face).
Use it to access the font face.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21283 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass/ass_cache.c')
-rw-r--r-- | libass/ass_cache.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/libass/ass_cache.c b/libass/ass_cache.c index c347ef0192..e4d41e45b0 100644 --- a/libass/ass_cache.c +++ b/libass/ass_cache.c @@ -71,46 +71,45 @@ static void charmap_magic(FT_Face face) * \param library FreeType library object * \param fontconfig_priv fontconfig private data * \param desc required face description - * \param face out: the face object + * \return new font struct */ -int ass_new_font(FT_Library library, void* fontconfig_priv, ass_font_desc_t* desc, /*out*/ FT_Face* face) +ass_font_t* ass_new_font(FT_Library library, void* fontconfig_priv, ass_font_desc_t* desc) { FT_Error error; int i; char* path; int index; ass_font_t* item; + FT_Face face; for (i=0; i<font_cache_size; ++i) - if (font_compare(desc, &(font_cache[i].desc))) { - *face = font_cache[i].face; - return 0; - } + if (font_compare(desc, &(font_cache[i].desc))) + return font_cache + i; if (font_cache_size == MAX_FONT_CACHE_SIZE) { mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_TooManyFonts); - return 1; + return 0; } path = fontconfig_select(fontconfig_priv, desc->family, desc->bold, desc->italic, &index); - error = FT_New_Face(library, path, index, face); + error = FT_New_Face(library, path, index, &face); if (error) { if (!no_more_font_messages) mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorOpeningFont, path, index); no_more_font_messages = 1; - return 1; + return 0; } - charmap_magic(*face); + charmap_magic(face); item = font_cache + font_cache_size; item->path = strdup(path); item->index = index; - item->face = *face; - memcpy(&(item->desc), desc, sizeof(font_desc_t)); + item->face = face; + memcpy(&(item->desc), desc, sizeof(ass_font_desc_t)); font_cache_size++; - return 0; + return item; } void ass_font_cache_init(void) |