summaryrefslogtreecommitdiffstats
path: root/libass/ass_directwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'libass/ass_directwrite.c')
-rw-r--r--libass/ass_directwrite.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libass/ass_directwrite.c b/libass/ass_directwrite.c
index 4545bf5..89e1099 100644
--- a/libass/ass_directwrite.c
+++ b/libass/ass_directwrite.c
@@ -490,28 +490,27 @@ static char *get_fallback(void *priv, ASS_Library *lib,
IDWriteTextLayout_Release(text_layout);
IDWriteTextFormat_Release(text_format);
- // Now, just extract the first family name
- BOOL exists = FALSE;
- IDWriteLocalizedStrings *familyNames = NULL;
- hr = IDWriteFont_GetInformationalStrings(font,
- DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
- &familyNames, &exists);
- if (FAILED(hr) || !exists) {
- IDWriteFont_Release(font);
- return NULL;
- }
-
// DirectWrite may not have found a valid fallback, so check that
// the selected font actually has the requested glyph.
+ BOOL exists = FALSE;
if (codepoint > 0) {
hr = IDWriteFont_HasCharacter(font, codepoint, &exists);
if (FAILED(hr) || !exists) {
- IDWriteLocalizedStrings_Release(familyNames);
IDWriteFont_Release(font);
return NULL;
}
}
+ // Now, just extract the first family name
+ IDWriteLocalizedStrings *familyNames = NULL;
+ hr = IDWriteFont_GetInformationalStrings(font,
+ DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
+ &familyNames, &exists);
+ if (FAILED(hr) || !exists) {
+ IDWriteFont_Release(font);
+ return NULL;
+ }
+
char *family = get_utf8_name(familyNames, 0);
IDWriteLocalizedStrings_Release(familyNames);