Kaydet (Commit) 1c48e4ef authored tarafından Michael Stahl's avatar Michael Stahl

fdo#66715: fontconfig: try harder to ignore duplicate fonts

The thin space not being displayed correctly is caused by using the
wrong font, namely
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf,
which (on Fedora 18) is version 1 and does not contain u2006 etc.
glyphs, whereas the LiberationSerif-Regular.ttf bundled with LO
is version 2 and does contain these.

There is already isPreviouslyDuplicateOrObsoleted() function to ignore
older fonts but it does not work for this case because:

1) Only the previous element was looked at, but there may be several
   fonts with different weight/slant that need to be checked.

2) The LiberationSerif-Regular.ttf differ in the "lang" entry.

Change-Id: I2f9e8d50a1f8155b65f8f07c9259dd988c32992a
üst 90dadcc9
...@@ -209,30 +209,37 @@ namespace ...@@ -209,30 +209,37 @@ namespace
//on being sorted with SortFont //on being sorted with SortFont
bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i) bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i)
{ {
if (i == 0)
return false;
const FcPattern *a = pFSet->fonts[i]; const FcPattern *a = pFSet->fonts[i];
const FcPattern *b = pFSet->fonts[i-1];
if (compareFontNames(a, b) != 0)
return false;
FcPattern* pTestPatternA = FcPatternDuplicate(a); FcPattern* pTestPatternA = FcPatternDuplicate(a);
FcPatternDel(pTestPatternA, FC_FILE); FcPatternDel(pTestPatternA, FC_FILE);
FcPatternDel(pTestPatternA, FC_CHARSET); FcPatternDel(pTestPatternA, FC_CHARSET);
FcPatternDel(pTestPatternA, FC_CAPABILITY); FcPatternDel(pTestPatternA, FC_CAPABILITY);
FcPatternDel(pTestPatternA, FC_FONTVERSION); FcPatternDel(pTestPatternA, FC_FONTVERSION);
FcPatternDel(pTestPatternA, FC_LANG);
bool bIsDup(false);
FcPattern* pTestPatternB = FcPatternDuplicate(b); // fdo#66715: loop for case of several font files for same font
FcPatternDel(pTestPatternB, FC_FILE); for (int j = i - 1; 0 <= j && !bIsDup; --j)
FcPatternDel(pTestPatternB, FC_CHARSET); {
FcPatternDel(pTestPatternB, FC_CAPABILITY); const FcPattern *b = pFSet->fonts[j];
FcPatternDel(pTestPatternB, FC_FONTVERSION);
bool bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB); if (compareFontNames(a, b) != 0)
break;
FcPattern* pTestPatternB = FcPatternDuplicate(b);
FcPatternDel(pTestPatternB, FC_FILE);
FcPatternDel(pTestPatternB, FC_CHARSET);
FcPatternDel(pTestPatternB, FC_CAPABILITY);
FcPatternDel(pTestPatternB, FC_FONTVERSION);
FcPatternDel(pTestPatternB, FC_LANG);
bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB);
FcPatternDestroy(pTestPatternB);
}
FcPatternDestroy(pTestPatternB);
FcPatternDestroy(pTestPatternA); FcPatternDestroy(pTestPatternA);
return bIsDup; return bIsDup;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment