[Libreoffice-commits] core.git: 2 commits - vcl/generic
Michael Stahl
mstahl at redhat.com
Tue Jul 30 07:38:37 PDT 2013
vcl/generic/fontmanager/fontconfig.cxx | 37 +++++++++++++++++++--------------
1 file changed, 22 insertions(+), 15 deletions(-)
New commits:
commit 1c48e4efa2369e5708798bdefb46b74a86415d00
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jul 30 16:11:54 2013 +0200
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
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 6bd45c9..769826d 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -209,30 +209,37 @@ namespace
//on being sorted with SortFont
bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i)
{
- if (i == 0)
- return false;
-
const FcPattern *a = pFSet->fonts[i];
- const FcPattern *b = pFSet->fonts[i-1];
-
- if (compareFontNames(a, b) != 0)
- return false;
FcPattern* pTestPatternA = FcPatternDuplicate(a);
FcPatternDel(pTestPatternA, FC_FILE);
FcPatternDel(pTestPatternA, FC_CHARSET);
FcPatternDel(pTestPatternA, FC_CAPABILITY);
FcPatternDel(pTestPatternA, FC_FONTVERSION);
+ FcPatternDel(pTestPatternA, FC_LANG);
+
+ bool bIsDup(false);
- FcPattern* pTestPatternB = FcPatternDuplicate(b);
- FcPatternDel(pTestPatternB, FC_FILE);
- FcPatternDel(pTestPatternB, FC_CHARSET);
- FcPatternDel(pTestPatternB, FC_CAPABILITY);
- FcPatternDel(pTestPatternB, FC_FONTVERSION);
+ // fdo#66715: loop for case of several font files for same font
+ for (int j = i - 1; 0 <= j && !bIsDup; --j)
+ {
+ const FcPattern *b = pFSet->fonts[j];
- 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);
return bIsDup;
commit 90dadcc9a0fc3d089f9318f073ce8374e4632da4
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jul 29 22:43:20 2013 +0200
vcl: fix obviously wrong mapping of WIDTH_ULTRA_EXPANDED
Change-Id: I2f23f51e7f04df6fcbc1e2d6661949b830cc248e
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 4768572..6bd45c9 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -777,7 +777,7 @@ static void addtopattern(FcPattern *pPattern,
case WIDTH_SEMI_EXPANDED: nWidth = FC_WIDTH_SEMIEXPANDED;break;
case WIDTH_EXPANDED: nWidth = FC_WIDTH_EXPANDED;break;
case WIDTH_EXTRA_EXPANDED: nWidth = FC_WIDTH_EXTRAEXPANDED;break;
- case WIDTH_ULTRA_EXPANDED: nWidth = FC_WIDTH_ULTRACONDENSED;break;
+ case WIDTH_ULTRA_EXPANDED: nWidth = FC_WIDTH_ULTRAEXPANDED;break;
default:
break;
}
More information about the Libreoffice-commits
mailing list