comparison libass/ass_font.c @ 23134:1de2a46a0987

Add -ass-hinting option for setting font hinting method. It is possible to separately configure hinting for scaled and unscaled osd. The default is native hinter for unscaled osd (only vo_gl at this point), no hinting for vf_ass.
author eugeni
date Fri, 27 Apr 2007 14:25:36 +0000
parents 4a958bd08920
children c932f521344d
comparison
equal deleted inserted replaced
23133:0574817cc6cb 23134:1de2a46a0987
227 227
228 /** 228 /**
229 * \brief Get a glyph 229 * \brief Get a glyph
230 * \param ch character code 230 * \param ch character code
231 **/ 231 **/
232 FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch) 232 FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch, ass_hinting_t hinting)
233 { 233 {
234 int error; 234 int error;
235 int index = 0; 235 int index = 0;
236 int i; 236 int i;
237 FT_Glyph glyph; 237 FT_Glyph glyph;
238 FT_Face face = 0; 238 FT_Face face = 0;
239 int flags = 0;
239 240
240 if (ch < 0x20) 241 if (ch < 0x20)
241 return 0; 242 return 0;
242 if (font->n_faces == 0) 243 if (font->n_faces == 0)
243 return 0; 244 return 0;
262 ch, font->desc.family, font->desc.bold, font->desc.italic); 263 ch, font->desc.family, font->desc.bold, font->desc.italic);
263 } 264 }
264 } 265 }
265 #endif 266 #endif
266 267
267 error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP ); 268 switch (hinting) {
269 case ASS_HINTING_NONE: flags = FT_LOAD_NO_HINTING; break;
270 case ASS_HINTING_LIGHT: flags = FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT; break;
271 case ASS_HINTING_NORMAL: flags = FT_LOAD_FORCE_AUTOHINT; break;
272 case ASS_HINTING_NATIVE: flags = 0; break;
273 }
274
275 error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags);
268 if (error) { 276 if (error) {
269 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph); 277 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
270 return 0; 278 return 0;
271 } 279 }
272 280