[Libreoffice-commits] core.git: vcl/inc vcl/unx

Caolán McNamara caolanm at redhat.com
Wed Nov 23 17:11:50 UTC 2016


 vcl/inc/unx/fc_fontoptions.hxx                 |    2 +-
 vcl/inc/unx/freetype_glyphcache.hxx            |    1 +
 vcl/inc/unx/glyphcache.hxx                     |    1 +
 vcl/unx/generic/fontmanager/fontconfig.cxx     |   25 ++++++++++---------------
 vcl/unx/generic/gdi/cairotextrender.cxx        |    7 ++-----
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   10 +++++-----
 6 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit 8c3e1465223bd8c824c4cecfd0e6fc387583e592
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 23 14:54:50 2016 +0000

    with wayland scaling cairo is meddling with our font
    
    so I see mixed large scaled and small unscaled letters in the writer header/footer
    widget among other places
    
    so don't give it our FreeType font face (FC_FT_FACE), keep that for ourselves,
    but instead set the filename and face index and let it make a new one itself.
    
    Change-Id: I2e5eceb7bf590ccfeb06123d0404120feacfff97
    Reviewed-on: https://gerrit.libreoffice.org/31127
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx
index e5dc491..340df27 100644
--- a/vcl/inc/unx/fc_fontoptions.hxx
+++ b/vcl/inc/unx/fc_fontoptions.hxx
@@ -51,7 +51,7 @@ public:
     bool                DontUseEmbeddedBitmaps() const { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; }
     bool                DontUseAntiAlias() const { return meAntiAlias == ANTIALIAS_FALSE; }
     bool                DontUseHinting() const { return (meHinting == FontHinting::No) || (GetHintStyle() == FontHintStyle::NONE); }
-    void*               GetPattern(void * /*pFace*/, bool /*bEmbolden*/) const;
+    FcPattern*          GetPattern(const OString& rFileName, int nFontFace, bool bEmbolden) const;
 private:
     FcPattern* mpPattern;
 };
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index 304a090..119dcda 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -72,6 +72,7 @@ public:
     void                  ReleaseFaceFT();
 
     const OString&        GetFontFileName() const   { return mpFontFile->GetFileName(); }
+    int                   GetFontFaceIndex() const  { return mnFaceNum; }
     sal_IntPtr            GetFontId() const         { return mnFontId; }
     bool                  IsSymbolFont() const      { return maDevFontAttributes.IsSymbolFont(); }
     const FontAttributes& GetFontAttributes() const { return maDevFontAttributes; }
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 366bd2a..15afbcd 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -151,6 +151,7 @@ public:
                            ~FreetypeFont();
 
     const OString&          GetFontFileName() const;
+    int                     GetFontFaceIndex() const;
     bool                    TestFont() const { return mbFaceOk;}
     FT_Face                 GetFtFace() const;
     int                     GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index a8731401..6b4c8e6 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -1154,21 +1154,16 @@ FontConfigFontOptions::~FontConfigFontOptions()
     FcPatternDestroy(mpPattern);
 }
 
-    void *FontConfigFontOptions::GetPattern(void * face, bool bEmbolden) const
-    {
-        FcValue value;
-        value.type = FcTypeFTFace;
-        value.u.f = face;
-        FcPatternDel(mpPattern, FC_FT_FACE);
-        FcPatternAdd (mpPattern, FC_FT_FACE, value, FcTrue);
-        FcPatternDel(mpPattern, FC_EMBOLDEN);
-        FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse);
-#if 0
-        FcPatternDel(mpPattern, FC_VERTICAL_LAYOUT);
-        FcPatternAddBool(mpPattern, FC_VERTICAL_LAYOUT, bVerticalLayout ? FcTrue : FcFalse);
-#endif
-        return mpPattern;
-    }
+FcPattern *FontConfigFontOptions::GetPattern(const OString& rFileName, int nIndex, bool bEmbolden) const
+{
+    FcPatternDel(mpPattern, FC_FILE);
+    FcPatternAddString(mpPattern, FC_FILE, reinterpret_cast<FcChar8 const *>(rFileName.getStr()));
+    FcPatternDel(mpPattern, FC_INDEX);
+    FcPatternAddInteger(mpPattern, FC_INDEX, nIndex);
+    FcPatternDel(mpPattern, FC_EMBOLDEN);
+    FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse);
+    return mpPattern;
+}
 
 FontConfigFontOptions* PrintFontManager::getFontOptions(
     const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*))
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 3c571f7..cce0312 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -289,11 +289,8 @@ void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, con
         if (!font_face)
         {
             const FontConfigFontOptions *pOptions = rFont.GetFontOptions().get();
-            void *pPattern = pOptions ? pOptions->GetPattern(aFace, aId.mbEmbolden) : nullptr;
-            if (pPattern)
-                font_face = cairo_ft_font_face_create_for_pattern(static_cast<FcPattern*>(pPattern));
-            if (!font_face)
-                font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(aFace), rFont.GetLoadFlags());
+            FcPattern *pPattern = pOptions->GetPattern(rFont.GetFontFileName(), rFont.GetFontFaceIndex(), aId.mbEmbolden);
+            font_face = cairo_ft_font_face_create_for_pattern(pPattern);
             CairoFontsCache::CacheFont(font_face, aId);
         }
         cairo_set_font_face(cr, font_face);
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 2102e4a..0bacb94 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -512,11 +512,7 @@ FreetypeFont::FreetypeFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI
         ApplyGSUB( rFSD );
 
     // TODO: query GASP table for load flags
-    mnLoadFlags = FT_LOAD_DEFAULT;
-#if 1 // #i97326# cairo sometimes uses FT_Set_Transform() on our FT_FACE
-    // we are not using FT_Set_Transform() yet, so just ignore it for now
-    mnLoadFlags |= FT_LOAD_IGNORE_TRANSFORM;
-#endif
+    mnLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_TRANSFORM;
 
     mbArtItalic = (rFSD.GetItalic() != ITALIC_NONE && pFI->GetFontAttributes().GetItalic() == ITALIC_NONE);
     mbArtBold = (rFSD.GetWeight() > WEIGHT_MEDIUM && pFI->GetFontAttributes().GetWeight() <= WEIGHT_MEDIUM);
@@ -602,6 +598,10 @@ const OString& FreetypeFont::GetFontFileName() const
     return mpFontInfo->GetFontFileName();
 }
 
+int FreetypeFont::GetFontFaceIndex() const
+{
+    return mpFontInfo->GetFontFaceIndex();
+}
 
 FreetypeFont::~FreetypeFont()
 {


More information about the Libreoffice-commits mailing list