]> granicus.if.org Git - libass/commitdiff
fontselect: expose the freetype-provided family as well
authorRodger Combs <rodger.combs@gmail.com>
Sat, 23 Mar 2019 13:30:16 +0000 (08:30 -0500)
committerOleg Oshmyan <chortos@inbox.lv>
Thu, 26 Sep 2019 13:51:09 +0000 (16:51 +0300)
libass/ass_fontselect.c

index 651fc7a520afb3e435e09cdc3345265a077adc1c..9c4bb3bba018a705a8537df83cdfb7f57058948c 100644 (file)
@@ -766,6 +766,13 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info)
     if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
         return false;
 
+    if (face->family_name) {
+        families[0] = strdup(face->family_name);
+        if (families[0] == NULL)
+            goto error;
+        num_family++;
+    }
+
     for (i = 0; i < num_names; i++) {
         FT_SfntName name;
 
@@ -793,15 +800,6 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info)
                 num_family++;
             }
         }
-
-    }
-
-    // check if we got a valid family - if not use whatever FreeType gives us
-    if (num_family == 0 && face->family_name) {
-        families[0] = strdup(face->family_name);
-        if (families[0] == NULL)
-            goto error;
-        num_family++;
     }
 
     // we absolutely need a name