Skip to content

Commit 8676275

Browse files
committed
Bug 2051021 - Remove workaround for ancient fontconfig version. r=jfkthame
Fontconfig 2.12 was released in 2017. We can probably remove this now. Differential Revision: https://phabricator.services.mozilla.com/D310802
1 parent 1ae5eed commit 8676275

1 file changed

Lines changed: 3 additions & 47 deletions

File tree

gfx/thebes/gfxFcPlatformFontList.cpp

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,37 +1707,8 @@ nsresult gfxFcPlatformFontList::InitFontListForPlatform() {
17071707
UpdateSystemFontOptionsFromIpc(fontList.options());
17081708
#endif
17091709

1710-
// For fontconfig versions between 2.10.94 and 2.11.1 inclusive,
1711-
// we need to escape any leading space in the charset element,
1712-
// otherwise FcNameParse will fail. :(
1713-
//
1714-
// The bug was introduced on 2013-05-24 by
1715-
// https://cgit.freedesktop.org/fontconfig/commit/?id=cd9b1033a68816a7acfbba1718ba0aa5888f6ec7
1716-
// "Bug 64906 - FcNameParse() should ignore leading whitespace in
1717-
// parameters"
1718-
// because ignoring a leading space in the encoded value of charset
1719-
// causes erroneous decoding of the whole element.
1720-
// This first shipped in version 2.10.94, and was eventually fixed as
1721-
// a side-effect of switching to the "human-readable" representation of
1722-
// charsets on 2014-07-03 in
1723-
// https://cgit.freedesktop.org/fontconfig/commit/?id=e708e97c351d3bc9f7030ef22ac2f007d5114730
1724-
// "Change charset parse/unparse format to be human readable"
1725-
// (with a followup fix next day) which means a leading space is no
1726-
// longer significant. This fix landed after 2.11.1 had been shipped,
1727-
// so the first version tag without the bug is 2.11.91.
1728-
int fcVersion = FcGetVersion();
1729-
bool fcCharsetParseBug = fcVersion >= 21094 && fcVersion <= 21101;
1730-
1731-
for (FontPatternListEntry& fpe : fontList.entries()) {
1732-
nsCString& patternStr = fpe.pattern();
1733-
if (fcCharsetParseBug) {
1734-
int32_t index = patternStr.Find(":charset= ");
1735-
if (index != kNotFound) {
1736-
// insert backslash after the =, before the space
1737-
patternStr.Insert('\\', index + 9);
1738-
}
1739-
}
1740-
FcPattern* pattern = FcNameParse((const FcChar8*)patternStr.get());
1710+
for (const FontPatternListEntry& fpe : fontList.entries()) {
1711+
FcPattern* pattern = FcNameParse((const FcChar8*)fpe.pattern().get());
17411712
AddPatternToFontList(pattern, lastFamilyName, familyName, fontFamily,
17421713
fpe.appFontFamily());
17431714
FcPatternDestroy(pattern);
@@ -1909,15 +1880,9 @@ void gfxFcPlatformFontList::InitSharedFontListForPlatform() {
19091880

19101881
nsClassHashtable<nsCStringHashKey, FacesData> faces;
19111882

1912-
// Do we need to work around the fontconfig FcNameParse/FcNameUnparse bug
1913-
// (present in versions between 2.10.94 and 2.11.1 inclusive)? See comment
1914-
// in InitFontListForPlatform for details.
1915-
int fcVersion = FcGetVersion();
1916-
bool fcCharsetParseBug = fcVersion >= 21094 && fcVersion <= 21101;
1917-
19181883
// Returns true if the font was added with FontVisibility::Base.
19191884
// This enables us to count how many known Base fonts are present.
1920-
auto addPattern = [this, fcCharsetParseBug, &families, &faces](
1885+
auto addPattern = [this, &families, &faces](
19211886
FcPattern* aPattern, FcChar8*& aLastFamilyName,
19221887
nsCString& aFamilyName, bool aAppFont) -> bool {
19231888
// get canonical name
@@ -1965,15 +1930,6 @@ void gfxFcPlatformFontList::InitSharedFontListForPlatform() {
19651930
free(s);
19661931
}
19671932

1968-
if (fcCharsetParseBug) {
1969-
// Escape any leading space in charset to work around FcNameParse bug.
1970-
int32_t index = descriptor.Find(":charset= ");
1971-
if (index != kNotFound) {
1972-
// insert backslash after the =, before the space
1973-
descriptor.Insert('\\', index + 9);
1974-
}
1975-
}
1976-
19771933
WeightRange weight(FontWeight::NORMAL);
19781934
StretchRange stretch(FontStretch::NORMAL);
19791935
SlantStyleRange style(FontSlantStyle::NORMAL);

0 commit comments

Comments
 (0)