comparison libvo/font_load_ft.c @ 23338:2a66d95355f0

add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
author ben
date Sun, 20 May 2007 16:10:45 +0000
parents ee21c7dff35f
children 8cd44c7487fc
comparison
equal deleted inserted replaced
23337:10a7279b8e56 23338:2a66d95355f0
940 940
941 int kerning(font_desc_t *desc, int prevc, int c) 941 int kerning(font_desc_t *desc, int prevc, int c)
942 { 942 {
943 FT_Vector kern; 943 FT_Vector kern;
944 944
945 if (!vo_font->dynamic) return 0; 945 if (!desc->dynamic) return 0;
946 if (prevc < 0 || c < 0) return 0; 946 if (prevc < 0 || c < 0) return 0;
947 if (desc->font[prevc] != desc->font[c]) return 0; 947 if (desc->font[prevc] != desc->font[c]) return 0;
948 if (desc->font[prevc] == -1 || desc->font[c] == -1) return 0; 948 if (desc->font[prevc] == -1 || desc->font[c] == -1) return 0;
949 FT_Get_Kerning(desc->faces[desc->font[c]], 949 FT_Get_Kerning(desc->faces[desc->font[c]],
950 desc->glyph_index[prevc], desc->glyph_index[c], 950 desc->glyph_index[prevc], desc->glyph_index[c],
1135 } 1135 }
1136 1136
1137 return 0; 1137 return 0;
1138 } 1138 }
1139 1139
1140 void load_font_ft(int width, int height) 1140 void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_name)
1141 { 1141 {
1142 #ifdef HAVE_FONTCONFIG 1142 #ifdef HAVE_FONTCONFIG
1143 FcPattern *fc_pattern; 1143 FcPattern *fc_pattern;
1144 FcPattern *fc_pattern2; 1144 FcPattern *fc_pattern2;
1145 FcChar8 *s; 1145 FcChar8 *s;
1146 FcBool scalable; 1146 FcBool scalable;
1147 #endif 1147 #endif
1148 font_desc_t *vo_font = *fontp;
1148 vo_image_width = width; 1149 vo_image_width = width;
1149 vo_image_height = height; 1150 vo_image_height = height;
1150 1151
1151 // protection against vo_aa font hacks 1152 // protection against vo_aa font hacks
1152 if (vo_font && !vo_font->dynamic) return; 1153 if (vo_font && !vo_font->dynamic) return;
1175 fc_pattern = FcFontMatch(0, fc_pattern, 0); 1176 fc_pattern = FcFontMatch(0, fc_pattern, 0);
1176 FcPatternDestroy(fc_pattern2); 1177 FcPatternDestroy(fc_pattern2);
1177 } 1178 }
1178 // s doesn't need to be freed according to fontconfig docs 1179 // s doesn't need to be freed according to fontconfig docs
1179 FcPatternGetString(fc_pattern, FC_FILE, 0, &s); 1180 FcPatternGetString(fc_pattern, FC_FILE, 0, &s);
1180 vo_font=read_font_desc_ft(s, width, height); 1181 *fontp=read_font_desc_ft(s, width, height);
1181 FcPatternDestroy(fc_pattern); 1182 FcPatternDestroy(fc_pattern);
1182 } 1183 }
1183 else 1184 else
1184 #endif 1185 #endif
1185 vo_font=read_font_desc_ft(font_name, width, height); 1186 *fontp=read_font_desc_ft(font_name, width, height);
1186 } 1187 }