]> granicus.if.org Git - libass/commitdiff
directwrite: fix fallback for codepoint 0
authorGrigori Goronzy <greg@chown.ath.cx>
Tue, 1 Sep 2015 14:33:33 +0000 (16:33 +0200)
committerwm4 <wm4@nowhere>
Tue, 1 Sep 2015 15:13:42 +0000 (17:13 +0200)
libass/ass_directwrite.c

index 333407d3865a6e80b93028defb2315afc0d24372..86b0b4b70d39b0fdf06e6bcdf39ac501768680d2 100644 (file)
@@ -441,11 +441,13 @@ static char *get_fallback(void *priv, const char *base, uint32_t codepoint)
 
     // DirectWrite may not have found a valid fallback, so check that
     // the selected font actually has the requested glyph.
-    hr = IDWriteFont_HasCharacter(font, codepoint, &exists);
-    if (FAILED(hr) || !exists) {
-        IDWriteLocalizedStrings_Release(familyNames);
-        IDWriteFont_Release(font);
-        return NULL;
+    if (codepoint > 0) {
+        hr = IDWriteFont_HasCharacter(font, codepoint, &exists);
+        if (FAILED(hr) || !exists) {
+            IDWriteLocalizedStrings_Release(familyNames);
+            IDWriteFont_Release(font);
+            return NULL;
+        }
     }
 
     int size_needed = WideCharToMultiByte(CP_UTF8, 0, temp_name, -1, NULL, 0,NULL, NULL);