summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/unx/glyphcache.hxx29
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx3
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx14
-rw-r--r--vcl/unx/generic/glyphs/glyphcache.cxx6
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx3
5 files changed, 10 insertions, 45 deletions
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index c86dbac36a6b..935837d2a8a7 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -94,39 +94,19 @@ private:
FreetypeManager* mpFtManager;
};
-class GlyphMetric
-{
-public:
- GlyphMetric() {}
-
- const Point& GetOffset() const { return maOffset; }
- const Size& GetSize() const { return maSize; }
-
-protected:
- friend class GlyphData;
- void SetOffset( int nX, int nY ) { maOffset = Point( nX, nY); }
- void SetSize( const Size& s ) { maSize = s; }
-
-private:
- Point maOffset;
- Size maSize;
-};
-
class GlyphData
{
public:
GlyphData() : mnLruValue(0) {}
- const GlyphMetric& GetMetric() const { return maGlyphMetric; }
-
- void SetSize( const Size& s) { maGlyphMetric.SetSize( s ); }
- void SetOffset( int nX, int nY ) { maGlyphMetric.SetOffset( nX, nY ); }
+ const Rectangle& GetBoundRect() const { return maBoundRect; }
+ void SetBoundRect(Rectangle r) { maBoundRect = r; }
void SetLruValue( int n ) const { mnLruValue = n; }
long GetLruValue() const { return mnLruValue;}
private:
- GlyphMetric maGlyphMetric;
+ Rectangle maBoundRect;
// used by GlyphCache for cache LRU algorithm
mutable long mnLruValue;
@@ -154,8 +134,7 @@ public:
const FontCharMapRef GetFontCharMap() const;
bool GetFontCapabilities(vcl::FontCapabilities &) const;
- const GlyphMetric& GetGlyphMetric(const GlyphItem& rGlyph);
-
+ const Rectangle& GetGlyphBoundRect(const GlyphItem& rGlyph);
bool GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon&) const;
bool GetAntialiasAdvice() const;
hb_font_t* GetHbFont() { return mpHbFont; }
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index b3f61657b7b6..842a6b643ed7 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -435,8 +435,7 @@ bool CairoTextRender::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRec
if( !pSF )
return false;
- const GlyphMetric& rGM = pSF->GetGlyphMetric(rGlyph);
- Rectangle aRect( rGM.GetOffset(), rGM.GetSize() );
+ Rectangle aRect = pSF->GetGlyphBoundRect(rGlyph);
if ( pSF->mnCos != 0x10000 && pSF->mnSin != 0 )
{
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index ca84009d81d1..50c5ebab77a1 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -635,12 +635,7 @@ void FreetypeFont::InitGlyphData(const GlyphItem& rGlyph, GlyphData& rGD ) const
FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId, mnLoadFlags);
if( rc != FT_Err_Ok )
- {
- // we get here e.g. when a PS font lacks the default glyph
- rGD.SetOffset( 0, 0 );
- rGD.SetSize( Size( 0, 0 ) );
return;
- }
if (mbArtBold)
FT_GlyphSlot_Embolden(maFaceFT->glyph);
@@ -652,15 +647,8 @@ void FreetypeFont::InitGlyphData(const GlyphItem& rGlyph, GlyphData& rGD ) const
FT_BBox aBbox;
FT_Glyph_Get_CBox( pGlyphFT, FT_GLYPH_BBOX_PIXELS, &aBbox );
- if( aBbox.yMin > aBbox.yMax ) // circumvent freetype bug
- {
- int t=aBbox.yMin;
- aBbox.yMin=aBbox.yMax;
- aBbox.yMax=t;
- }
- rGD.SetOffset( aBbox.xMin, -aBbox.yMax );
- rGD.SetSize( Size( (aBbox.xMax-aBbox.xMin+1), (aBbox.yMax-aBbox.yMin) ) );
+ rGD.SetBoundRect(Rectangle(aBbox.xMin, -aBbox.yMax, aBbox.xMax, -aBbox.yMin));
FT_Done_Glyph( pGlyphFT );
}
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index 103fc5468793..1a49c524415f 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -304,14 +304,14 @@ long FreetypeFont::Release() const
return --mnRefCount;
}
-const GlyphMetric& FreetypeFont::GetGlyphMetric(const GlyphItem& rGlyph)
+const Rectangle& FreetypeFont::GetGlyphBoundRect(const GlyphItem& rGlyph)
{
// usually the GlyphData is cached
GlyphList::iterator it = maGlyphList.find(rGlyph.maGlyphId);
if( it != maGlyphList.end() ) {
GlyphData& rGlyphData = it->second;
GlyphCache::GetInstance().UsingGlyph( *this, rGlyphData );
- return rGlyphData.GetMetric();
+ return rGlyphData.GetBoundRect();
}
// sometimes not => we need to create and initialize it ourselves
@@ -319,7 +319,7 @@ const GlyphMetric& FreetypeFont::GetGlyphMetric(const GlyphItem& rGlyph)
mnBytesUsed += sizeof( GlyphData );
InitGlyphData(rGlyph, rGlyphData);
GlyphCache::GetInstance().AddedGlyph( *this, rGlyphData );
- return rGlyphData.GetMetric();
+ return rGlyphData.GetBoundRect();
}
void FreetypeFont::GarbageCollect( long nMinLruIndex )
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index a9ff215a97ea..eb89e8bcf057 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -768,8 +768,7 @@ bool GenPspGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect
if( !pSF )
return false;
- const GlyphMetric& rGM = pSF->GetGlyphMetric(rGlyph);
- rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() );
+ rRect = pSF->GetGlyphBoundRect(rGlyph);
return true;
}