diff options
author | Akira TAGOH <akira@tagoh.org> | 2021-06-28 17:36:11 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2021-06-28 17:37:23 +0900 |
commit | d62d984e2bfe5b9c7767e8ad657ec93652d52bbd (patch) | |
tree | 4120adbfc1367a1f50d4651f229eda7eb58c599a /src/fcfreetype.c | |
parent | fe2fa4d1f4a0aaf4092c8f5e3e5b40e567c8f2b7 (diff) | |
download | fontconfig-d62d984e2bfe5b9c7767e8ad657ec93652d52bbd.tar.gz |
Revert constructing fullname property from family and style properties
This seems making a regression in Java. we will revisit this issue later.
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/277
Diffstat (limited to 'src/fcfreetype.c')
-rw-r--r-- | src/fcfreetype.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 4b545bf..ee86eb9 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1655,6 +1655,61 @@ FcFreeTypeQueryFaceInternal (const FT_Face face, ++nfamily; } + /* Add the fullname into the cache */ + if (!variable && !nfullname) + { + FcChar8 *family, *style, *lang; + int n = 0; + size_t len, i; + FcStrBuf sbuf; + + while (FcPatternObjectGetString (pat, FC_FAMILYLANG_OBJECT, n, &lang) == FcResultMatch) + { + if (FcStrCmp (lang, (const FcChar8 *) "en") == 0) + break; + n++; + lang = NULL; + } + if (!lang) + n = 0; + if (FcPatternObjectGetString (pat, FC_FAMILY_OBJECT, n, &family) != FcResultMatch) + goto bail1; + len = strlen ((const char *) family); + for (i = len; i > 0; i--) + { + if (!isspace (family[i])) + break; + } + family[i] = 0; + while (FcPatternObjectGetString (pat, FC_STYLELANG_OBJECT, n, &lang) == FcResultMatch) + { + if (FcStrCmp (lang, (const FcChar8 *) "en") == 0) + break; + n++; + lang = NULL; + } + if (!lang) + n = 0; + if (FcPatternObjectGetString (pat, FC_STYLE_OBJECT, n, &style) != FcResultMatch) + goto bail1; + len = strlen ((const char *) style); + for (i = 0; style[i] != 0 && isspace (style[i]); i++) + break; + memcpy (style, &style[i], len - i); + FcStrBufInit (&sbuf, NULL, 0); + FcStrBufString (&sbuf, family); + FcStrBufChar (&sbuf, ' '); + FcStrBufString (&sbuf, style); + if (!FcPatternObjectAddString (pat, FC_FULLNAME_OBJECT, FcStrBufDoneStatic (&sbuf))) + { + FcStrBufDestroy (&sbuf); + goto bail1; + } + FcStrBufDestroy (&sbuf); + if (!FcPatternObjectAddString (pat, FC_FULLNAMELANG_OBJECT, (const FcChar8 *) "en")) + goto bail1; + ++nfullname; + } /* Add the PostScript name into the cache */ if (!variable) { |