summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-04-27 14:57:12 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-04-29 12:45:39 +0200
commit8f748ce03b724ea67738054bc32325fdf950fc0c (patch)
tree7f83e56363ff55409c99d6606d23788874b58d5b /vcl
parent9cd7f7aded9ba171bf91a8223e6e8a868aedd792 (diff)
[harfbuzz] Check for SAL_USE_HARFBUZZ in one place
Change-Id: I78efebb576dffa8d39e98283feb9aab2186b5a39
Diffstat (limited to 'vcl')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx32
-rw-r--r--vcl/inc/generic/glyphcache.hxx4
2 files changed, 20 insertions, 16 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 22cb8f77fdb7..b4137bbd80f7 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -49,7 +49,12 @@
ServerFontLayout::ServerFontLayout( ServerFont& rFont )
: mrServerFont( rFont )
-{}
+{
+ bUseHarfBuzz = false;
+#if ENABLE_HARFBUZZ
+ bUseHarfBuzz = (getenv("SAL_USE_HARFBUZZ") != NULL);
+#endif
+}
void ServerFontLayout::DrawText( SalGraphics& rSalGraphics ) const
{
@@ -60,7 +65,7 @@ void ServerFontLayout::DrawText( SalGraphics& rSalGraphics ) const
bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs )
{
- ServerFontLayoutEngine* pLE = mrServerFont.GetLayoutEngine();
+ ServerFontLayoutEngine* pLE = mrServerFont.GetLayoutEngine(bUseHarfBuzz);
assert(pLE);
bool bRet = pLE ? pLE->layout(*this, rArgs) : false;
return bRet;
@@ -70,9 +75,8 @@ bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs )
long ServerFontLayout::GetTextWidth() const
{
long nWidth;
-#if ENABLE_HARFBUZZ
- const char* pUseHarfBuzz = getenv("SAL_USE_HARFBUZZ");
- if (pUseHarfBuzz) {
+ if (bUseHarfBuzz)
+ {
GlyphVector aGlyphItems = GenericSalLayout::GetGlyphItems();
if( aGlyphItems.empty() )
@@ -96,8 +100,10 @@ long ServerFontLayout::GetTextWidth() const
nWidth = nMaxPos - nMinPos;
}
else
-#endif
- nWidth = GenericSalLayout::GetTextWidth();
+ {
+ nWidth = GenericSalLayout::GetTextWidth();
+ }
+
return nWidth;
}
@@ -126,14 +132,11 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
void ServerFontLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
{
-#if ENABLE_HARFBUZZ
// No idea what issue ApplyDXArray() was supposed to fix, but whatever
// GenericSalLayout::ApplyDXArray() does it just breaks our perfectly
// positioned text.
- const char* pUseHarfBuzz = getenv("SAL_USE_HARFBUZZ");
- if (!pUseHarfBuzz)
-#endif
- GenericSalLayout::ApplyDXArray(rArgs);
+ if (!bUseHarfBuzz)
+ GenericSalLayout::ApplyDXArray(rArgs);
}
// =======================================================================
@@ -1160,13 +1163,12 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
// =======================================================================
-ServerFontLayoutEngine* ServerFont::GetLayoutEngine()
+ServerFontLayoutEngine* ServerFont::GetLayoutEngine(bool bUseHarfBuzz)
{
// find best layout engine for font, platform, script and language
if (!mpLayoutEngine) {
#if ENABLE_HARFBUZZ
- const char* pUseHarfBuzz = getenv("SAL_USE_HARFBUZZ");
- if (pUseHarfBuzz)
+ if (bUseHarfBuzz)
mpLayoutEngine = new HbLayoutEngine(*this);
else
#endif
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 322dd750925f..2225971673e1 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -240,7 +240,7 @@ private:
int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const;
bool ApplyGSUB( const FontSelectPattern& );
- ServerFontLayoutEngine* GetLayoutEngine();
+ ServerFontLayoutEngine* GetLayoutEngine( bool );
typedef ::boost::unordered_map<int,GlyphData> GlyphList;
mutable GlyphList maGlyphList;
@@ -318,6 +318,8 @@ private:
SAL_DLLPRIVATE ServerFontLayout( const ServerFontLayout& );
SAL_DLLPRIVATE ServerFontLayout& operator=( const ServerFontLayout& );
+ bool bUseHarfBuzz;
+
public:
ServerFontLayout( ServerFont& );
virtual bool LayoutText( ImplLayoutArgs& );