comparison libass/ass_render.c @ 23022:199a3c6f54e8

Make get_*_glyph return void.
author eugeni
date Fri, 20 Apr 2007 23:10:33 +0000
parents a81c390d4a22
children 0694bbf7ac84
comparison
equal deleted inserted replaced
23021:a81c390d4a22 23022:199a3c6f54e8
1222 1222
1223 static void free_render_context(void) 1223 static void free_render_context(void)
1224 { 1224 {
1225 } 1225 }
1226 1226
1227 static int get_outline_glyph(int symbol, glyph_info_t* info, FT_Vector* advance) 1227 static void get_outline_glyph(int symbol, glyph_info_t* info, FT_Vector* advance)
1228 { 1228 {
1229 int error; 1229 int error;
1230 glyph_hash_val_t* val; 1230 glyph_hash_val_t* val;
1231 glyph_hash_key_t key; 1231 glyph_hash_key_t key;
1232 key.font = render_context.font; 1232 key.font = render_context.font;
1248 info->advance.y = val->advance.y; 1248 info->advance.y = val->advance.y;
1249 } else { 1249 } else {
1250 glyph_hash_val_t v; 1250 glyph_hash_val_t v;
1251 info->glyph = ass_font_get_glyph(frame_context.ass_priv->fontconfig_priv, render_context.font, symbol); 1251 info->glyph = ass_font_get_glyph(frame_context.ass_priv->fontconfig_priv, render_context.font, symbol);
1252 if (!info->glyph) 1252 if (!info->glyph)
1253 return 0; 1253 return;
1254 info->advance.x = d16_to_d6(info->glyph->advance.x); 1254 info->advance.x = d16_to_d6(info->glyph->advance.x);
1255 info->advance.y = d16_to_d6(info->glyph->advance.y); 1255 info->advance.y = d16_to_d6(info->glyph->advance.y);
1256 FT_Glyph_Get_CBox( info->glyph, FT_GLYPH_BBOX_PIXELS, &info->bbox); 1256 FT_Glyph_Get_CBox( info->glyph, FT_GLYPH_BBOX_PIXELS, &info->bbox);
1257 1257
1258 FT_Glyph_Copy(info->glyph, &v.glyph); 1258 FT_Glyph_Copy(info->glyph, &v.glyph);
1266 error = FT_Glyph_StrokeBorder( &(info->outline_glyph), render_context.stroker, 0 , 0 ); // don't destroy original 1266 error = FT_Glyph_StrokeBorder( &(info->outline_glyph), render_context.stroker, 0 , 0 ); // don't destroy original
1267 if (error) { 1267 if (error) {
1268 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FT_Glyph_Stroke_Error, error); 1268 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FT_Glyph_Stroke_Error, error);
1269 } 1269 }
1270 } 1270 }
1271 return 0;
1272 } 1271 }
1273 1272
1274 /** 1273 /**
1275 * \brief Get normal and outline glyphs from cache (if possible) or font face 1274 * \brief Get normal and outline glyphs from cache (if possible) or font face
1276 * \param index face glyph index 1275 * \param index face glyph index
1277 * \param symbol ucs4 char 1276 * \param symbol ucs4 char
1278 * \param info out: struct filled with extracted data 1277 * \param info out: struct filled with extracted data
1279 * \param advance advance vector of the extracted glyph 1278 * \param advance advance vector of the extracted glyph
1280 * \return 0 on success 1279 * \return 0 on success
1281 */ 1280 */
1282 static int get_bitmap_glyph(int symbol, glyph_info_t* info, FT_Vector* advance) 1281 static void get_bitmap_glyph(int symbol, glyph_info_t* info, FT_Vector* advance)
1283 { 1282 {
1284 int error;
1285 bitmap_hash_val_t* val; 1283 bitmap_hash_val_t* val;
1286 bitmap_hash_key_t* key = &(info->hash_key); 1284 bitmap_hash_key_t* key = &(info->hash_key);
1287 1285
1288 key->font = render_context.font; 1286 key->font = render_context.font;
1289 key->size = render_context.font_size; 1287 key->size = render_context.font_size;
1309 info->bbox = val->bbox_scaled; 1307 info->bbox = val->bbox_scaled;
1310 info->advance.x = val->advance.x; 1308 info->advance.x = val->advance.x;
1311 info->advance.y = val->advance.y; 1309 info->advance.y = val->advance.y;
1312 } else 1310 } else
1313 info->bm = info->bm_o = info->bm_s = 0; 1311 info->bm = info->bm_o = info->bm_s = 0;
1314
1315 return 0;
1316 } 1312 }
1317 1313
1318 /** 1314 /**
1319 * This function goes through text_info and calculates text parameters. 1315 * This function goes through text_info and calculates text parameters.
1320 * The following text_info fields are filled: 1316 * The following text_info fields are filled:
1765 matrix.yy = (FT_Fixed)( render_context.scale_y * 0x10000L ); 1761 matrix.yy = (FT_Fixed)( render_context.scale_y * 0x10000L );
1766 1762
1767 ass_font_set_transform(render_context.font, &matrix, &shift ); 1763 ass_font_set_transform(render_context.font, &matrix, &shift );
1768 } 1764 }
1769 1765
1770 error = get_outline_glyph(code, text_info.glyphs + text_info.length, &shift); 1766 get_outline_glyph(code, text_info.glyphs + text_info.length, &shift);
1771 error |= get_bitmap_glyph(code, text_info.glyphs + text_info.length, &shift); 1767 get_bitmap_glyph(code, text_info.glyphs + text_info.length, &shift);
1772
1773 if (error) {
1774 continue;
1775 }
1776 1768
1777 text_info.glyphs[text_info.length].pos.x = pen.x >> 6; 1769 text_info.glyphs[text_info.length].pos.x = pen.x >> 6;
1778 text_info.glyphs[text_info.length].pos.y = pen.y >> 6; 1770 text_info.glyphs[text_info.length].pos.y = pen.y >> 6;
1779 1771
1780 pen.x += text_info.glyphs[text_info.length].advance.x; 1772 pen.x += text_info.glyphs[text_info.length].advance.x;