[Libreoffice-commits] .: vcl/inc vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Aug 2 06:43:10 PDT 2011
vcl/inc/impfont.hxx | 2 +-
vcl/inc/unx/salgdi.h | 4 +++-
vcl/unx/generic/fontmanager/fontconfig.cxx | 6 +++++-
vcl/unx/generic/gdi/salgdi3.cxx | 29 ++++++++++++++---------------
4 files changed, 23 insertions(+), 18 deletions(-)
New commits:
commit a4cb73971411e967622fb625bfde948e546112b2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Aug 2 14:42:54 2011 +0100
add vertical layout as a distinguishing font layout attribute
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index ddee97e..523854b 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -166,7 +166,7 @@ public:
{ return meAntiAlias == ANTIALIAS_FALSE; }
bool DontUseHinting() const
{ return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); }
- virtual void *GetPattern(void * /*pFace*/, bool /*bEmbolden*/) const
+ virtual void *GetPattern(void * /*pFace*/, bool /*bEmbolden*/, bool /*bVerticalMetrics*/) const
{ return NULL; }
};
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index d03d1df..c212767 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -72,11 +72,13 @@ public:
const void *mpFace;
const void *mpOptions;
bool mbEmbolden;
+ bool mbVerticalMetrics;
bool operator ==(const CacheId& rOther) const
{
return mpFace == rOther.mpFace &&
mpOptions == rOther.mpOptions &&
- mbEmbolden == rOther.mbEmbolden;
+ mbEmbolden == rOther.mbEmbolden &&
+ mbVerticalMetrics == rOther.mbVerticalMetrics;
}
};
private:
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 5e97bec..7f9d882 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -870,13 +870,17 @@ public:
{
FcPatternDestroy(mpPattern);
}
- virtual void *GetPattern(void * face, bool bEmbolden) const
+ virtual void *GetPattern(void * face, bool bEmbolden, bool bVerticalLayout) 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);
+ FcPatternDel(mpPattern, FC_VERTICAL_LAYOUT);
+ FcPatternAddBool(mpPattern, FC_VERTICAL_LAYOUT, bVerticalLayout ? FcTrue : FcFalse);
return mpPattern;
}
FcPattern* mpPattern;
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index 9f9601f..b3a8099 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -371,26 +371,11 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
ServerFont& rFont = rLayout.GetServerFont();
- cairo_font_face_t* font_face = NULL;
-
void* pFace = rFont.GetFtFace();
CairoFontsCache::CacheId aId;
aId.mpFace = pFace;
aId.mpOptions = rFont.GetFontOptions().get();
aId.mbEmbolden = rFont.NeedsArtificialBold();
- font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(aId);
- if (!font_face)
- {
- const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
- void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL;
- if (pPattern)
- font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern));
- if (!font_face)
- font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags());
- m_aCairoFontsCache.CacheFont(font_face, aId);
- }
-
- cairo_set_font_face(cr, font_face);
cairo_matrix_t m;
const ImplFontSelectData& rFSD = rFont.GetFontSelData();
@@ -409,6 +394,20 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
size_t nStartIndex = std::distance(aStart, aI);
size_t nLen = std::distance(aI, aNext);
+ aId.mbVerticalMetrics = nGlyphRotation != 0.0;
+ cairo_font_face_t* font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(aId);
+ if (!font_face)
+ {
+ const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
+ void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden, aId.mbVerticalMetrics) : NULL;
+ if (pPattern)
+ font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern));
+ if (!font_face)
+ font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags());
+ m_aCairoFontsCache.CacheFont(font_face, aId);
+ }
+ cairo_set_font_face(cr, font_face);
+
cairo_set_font_size(cr, nHeight);
cairo_matrix_init_identity(&m);
More information about the Libreoffice-commits
mailing list