Tired of matching the names and order of the callbacks in my head.
While we're at it, also give some of the callbacks better names.
}
static ASS_FontProviderFuncs coretext_callbacks = {
- NULL,
- check_glyph,
- destroy_font,
- NULL,
-#if CT_FONTS_EAGER_LOAD
- NULL,
-#else
- match_fonts,
+ .check_glyph = check_glyph,
+ .destroy_font = destroy_font,
+#if !CT_FONTS_EAGER_LOAD
+ .match_fonts = match_fonts,
#endif
- NULL,
- get_fallback
+ .get_fallback = get_fallback,
};
ASS_FontProvider *
* specified task
*/
static ASS_FontProviderFuncs directwrite_callbacks = {
- get_data,
- check_glyph,
- destroy_font,
- destroy_provider,
- NULL,
- NULL,
- get_fallback
+ .get_data = get_data,
+ .check_glyph = check_glyph,
+ .destroy_font = destroy_font,
+ .destroy_provider = destroy_provider,
+ .get_fallback = get_fallback,
};
typedef HRESULT WINAPI (*DWriteCreateFactoryFn)(
}
static ASS_FontProviderFuncs fontconfig_callbacks = {
- NULL,
- check_glyph,
- NULL,
- destroy,
- NULL,
- get_substitutions,
- get_fallback
+ .check_glyph = check_glyph,
+ .destroy_provider = destroy,
+ .get_substitutions = get_substitutions,
+ .get_fallback = get_fallback,
};
ASS_FontProvider *
};
// get a list of substitutes if applicable, and use it for matching
- if (default_provider && default_provider->funcs.subst_font) {
- default_provider->funcs.subst_font(default_provider->priv, family_trim, &meta);
+ if (default_provider && default_provider->funcs.get_substitutions) {
+ default_provider->funcs.get_substitutions(default_provider->priv,
+ family_trim, &meta);
}
if (!meta.n_fullname) {
meta = default_meta;
family, bold, italic, res, *index, *postscript_name);
}
- if (!res && default_provider && default_provider->funcs.fallback_font) {
+ if (!res && default_provider && default_provider->funcs.get_fallback) {
ASS_FontProviderMetaData meta;
meta.families = &family;
meta.weight = bold;
meta.slant = italic;
meta.width = 100;
- char *fallback_family = default_provider->funcs.fallback_font(
+ char *fallback_family = default_provider->funcs.get_fallback(
default_provider->priv, &meta, code);
if (fallback_family) {
* Note that fontselect uses the font provider set as default to determine
* fallbacks.
*
- * \param font_priv font private data
+ * \param priv font provider private data
* \param codepoint Unicode codepoint (UTF-32)
* \return output font family, allocated with malloc(), must be freed
* by caller.
*/
-typedef char *(*GetFallbackFunc)(void *font_priv,
+typedef char *(*GetFallbackFunc)(void *priv,
ASS_FontProviderMetaData *meta,
uint32_t codepoint);
typedef struct font_provider_funcs {
- GetDataFunc get_data; /* optional/mandatory */
- CheckGlyphFunc check_glyph; /* mandatory */
- DestroyFontFunc destroy_font; /* optional */
- DestroyProviderFunc destroy_provider; /* optional */
- MatchFontsFunc match_fonts; /* optional */
- SubstituteFontFunc subst_font; /* optional */
- GetFallbackFunc fallback_font; /* optional */
+ GetDataFunc get_data; /* optional/mandatory */
+ CheckGlyphFunc check_glyph; /* mandatory */
+ DestroyFontFunc destroy_font; /* optional */
+ DestroyProviderFunc destroy_provider; /* optional */
+ MatchFontsFunc match_fonts; /* optional */
+ SubstituteFontFunc get_substitutions; /* optional */
+ GetFallbackFunc get_fallback; /* optional */
} ASS_FontProviderFuncs;
/*