]> granicus.if.org Git - libass/commitdiff
fontselect: trim names of embedded fonts
authorGrigori Goronzy <greg@chown.ath.cx>
Fri, 12 Jun 2015 01:20:49 +0000 (03:20 +0200)
committerGrigori Goronzy <greg@chown.ath.cx>
Fri, 10 Jul 2015 08:43:16 +0000 (10:43 +0200)
Embedded fonts tend to be extra bad, so trim the names. I have
encountered fonts faces with untrimmed names.

Leave this at the discretion of the font provider for platform-specific
font providers.

libass/ass_fontselect.c

index 3fcd8c737e791a81d3cda45bfa078f6d79f737d1..783f44c4b565cea18ffaaad6eba6dc19b39cb11a 100644 (file)
@@ -645,14 +645,14 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info)
             *bufptr = '\0';
 
             if (name.name_id == 4) {
-                fullnames[num_fullname] = strdup(buf);
+                fullnames[num_fullname] = strdup_trimmed(buf);
                 if (fullnames[num_fullname] == NULL)
                     goto error;
                 num_fullname++;
             }
 
             if (name.name_id == 1) {
-                families[num_family] = strdup(buf);
+                families[num_family] = strdup_trimmed(buf);
                 if (families[num_family] == NULL)
                     goto error;
                 num_family++;