summaryrefslogtreecommitdiffstats
path: root/libass/ass_fontselect.h
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2021-05-23 05:19:28 +0300
committerOleg Oshmyan <chortos@inbox.lv>2021-06-07 13:42:02 +0200
commit6fc9855dac44699242ded580040838da032c3a9d (patch)
tree0dccf903d7064c3c8374213c7c76281bddcee7cd /libass/ass_fontselect.h
parentbfffc82c88b55071901f7d00ebe3e66168cd5a6d (diff)
downloadlibass-6fc9855dac44699242ded580040838da032c3a9d.tar.bz2
libass-6fc9855dac44699242ded580040838da032c3a9d.tar.xz
fontselect, coretext: match whole extended family on fallback
Currently implemented only for coretext, but other providers may/should add this later. This improves fallback font choice by considering the whole extended family. This also fixes remaining cases of Core Text fallback failure caused by differences among the names recognized by Core Text, the name we choose to return from get_fallback, and the names we seek in find_font. This partly reverts commit 152d0484e98f118d01987138695cf40579c9e297. This fixes https://github.com/libass/libass/issues/512.
Diffstat (limited to 'libass/ass_fontselect.h')
-rw-r--r--libass/ass_fontselect.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/libass/ass_fontselect.h b/libass/ass_fontselect.h
index 942ea00..ce71b90 100644
--- a/libass/ass_fontselect.h
+++ b/libass/ass_fontselect.h
@@ -132,7 +132,7 @@ typedef void (*SubstituteFontFunc)(void *priv, const char *name,
ASS_FontProviderMetaData *meta);
/**
- * Get an appropriate fallback font for a given codepoint.
+ * Get an appropriate fallback extended font family for a given codepoint.
*
* This is called by fontselect whenever a glyph is not found in the
* physical font list of a logical font. fontselect will try to add the
@@ -147,7 +147,7 @@ typedef void (*SubstituteFontFunc)(void *priv, const char *name,
* \param lib ASS_Library instance
* \param family original font family name (try matching a similar font) (never NULL)
* \param codepoint Unicode codepoint (UTF-32)
- * \return output font family, allocated with malloc(), must be freed
+ * \return output extended font family, allocated with malloc(), must be freed
* by caller.
*/
typedef char *(*GetFallbackFunc)(void *priv,
@@ -173,21 +173,32 @@ typedef struct font_provider_funcs {
*/
struct ass_font_provider_meta_data {
/**
- * List of localized font family names, e.g. "Arial".
+ * List of localized font family names,
+ * e.g. "Arial", "Arial Narrow" or "Arial Black".
*/
char **families;
/**
- * List of localized full names, e.g. "Arial Bold".
+ * List of localized full names, e.g. "Arial Bold",
+ * "Arial Narrow Bold", "Arial Black" or "Arial Black Normal".
* The English name should be listed first to speed up typical matching.
*/
char **fullnames;
/**
- * The PostScript name, e.g. "Arial-BoldMT".
+ * The PostScript name, e.g. "Arial-BoldMT",
+ * "ArialNarrow-Bold" or "Arial-Black".
*/
char *postscript_name;
+ /**
+ * Any name that identifies an extended font family, e.g. "Arial".
+ * This could be the full designer-named typographic family or (perhaps
+ * even better) a (sub)family limited to weight/width/slant variations.
+ * Names returned by get_fallback are matched against this field.
+ */
+ char *extended_family;
+
int n_family; // Number of localized family names
int n_fullname; // Number of localized full names