summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-23 14:54:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-11-23 17:11:25 +0000
commit8c3e1465223bd8c824c4cecfd0e6fc387583e592 (patch)
tree2c81a8a357a3886367f09f8be61a26b547491416
parent24a24e65cafffe137d76de0a6eb5270ea88ebffd (diff)
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@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/inc/unx/fc_fontoptions.hxx2
-rw-r--r--vcl/inc/unx/freetype_glyphcache.hxx1
-rw-r--r--vcl/inc/unx/glyphcache.hxx1
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx25
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx7
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx10
6 files changed, 20 insertions, 26 deletions
diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx
index e5dc49161bc5..340df276e6d3 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 304a090a919c..119dcda7d1fc 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 366bd2a5d0fb..15afbcdbc906 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 a8731401971f..6b4c8e6ed9d6 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 3c571f77bd0a..cce03121916b 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 2102e4a4c0e9..0bacb9455958 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()
{