diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-18 14:00:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-18 15:48:30 +0100 |
commit | f17a2a006388d33d26adf9038795550361c0d62b (patch) | |
tree | 950db9af22cd687bbb06987a51da1a6ceceeec33 /vcl | |
parent | USE_BUILTIN_RASTERIZER is never set (diff) | |
download | core-f17a2a006388d33d26adf9038795550361c0d62b.tar.gz core-f17a2a006388d33d26adf9038795550361c0d62b.zip |
remove various casts from ServerFont to FreetypeServeFont
i.e. add the missing api directly to ServerFont
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/Library_vclplug_svp.mk | 4 | ||||
-rw-r--r-- | vcl/inc/glyphcache.hxx | 17 | ||||
-rw-r--r-- | vcl/inc/graphite_serverfont.hxx | 2 | ||||
-rw-r--r-- | vcl/source/glyphs/gcach_ftyp.hxx | 14 | ||||
-rw-r--r-- | vcl/source/glyphs/gcach_layout.cxx | 12 | ||||
-rw-r--r-- | vcl/source/glyphs/graphite_serverfont.cxx | 37 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/pspgraphics.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi3.cxx | 2 |
8 files changed, 52 insertions, 38 deletions
diff --git a/vcl/Library_vclplug_svp.mk b/vcl/Library_vclplug_svp.mk index d6a67f826e46..c2e2e3ce46f1 100644 --- a/vcl/Library_vclplug_svp.mk +++ b/vcl/Library_vclplug_svp.mk @@ -36,6 +36,10 @@ $(eval $(call gb_Library_set_include,vclplug_svp,\ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_cxxflags,vclplug_svp,\ + $$(FREETYPE_CFLAGS) \ +)) + $(eval $(call gb_Library_add_defs,vclplug_svp,\ -DVCLPLUG_SVP_IMPLEMENTATION \ )) diff --git a/vcl/inc/glyphcache.hxx b/vcl/inc/glyphcache.hxx index 62d27c70bdcf..a94ccd2b2130 100644 --- a/vcl/inc/glyphcache.hxx +++ b/vcl/inc/glyphcache.hxx @@ -57,6 +57,13 @@ class RawBitmap; class ServerFontLayout; #include <sallayout.hxx> +#ifdef ENABLE_GRAPHITE +class GraphiteFaceWrapper; +#endif + +#include <ft2build.h> +#include FT_FREETYPE_H + namespace vcl { struct FontCapabilities; @@ -191,7 +198,10 @@ public: const ImplFontSelectData& GetFontSelData() const { return maFontSelData; } virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const = 0; - virtual sal_uLong GetKernPairs( ImplKernPairData** ) const = 0; + virtual sal_uLong GetKernPairs( ImplKernPairData** ) const = 0; + virtual const unsigned char* GetTable( const char* pName, sal_uLong* pLength ) = 0; + virtual int GetEmUnits() const = 0; + virtual const FT_Size_Metrics& GetMetricsFT() const = 0; virtual int GetGlyphKernValue( int, int ) const = 0; virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; virtual bool GetFontCapabilities(vcl::FontCapabilities &) const = 0; @@ -200,8 +210,13 @@ public: GlyphData& GetGlyphData( int nGlyphIndex ); const GlyphMetric& GetGlyphMetric( int nGlyphIndex ) { return GetGlyphData( nGlyphIndex ).GetMetric(); } +#ifdef ENABLE_GRAPHITE + virtual GraphiteFaceWrapper* GetGraphiteFace() const = 0; +#endif virtual int GetGlyphIndex( sal_UCS4 ) const = 0; + virtual int GetRawGlyphIndex( sal_UCS4 ) const = 0; + virtual int FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const = 0; virtual bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const = 0; virtual bool GetAntialiasAdvice( void ) const = 0; bool IsGlyphInvisible( int nGlyphIndex ); diff --git a/vcl/inc/graphite_serverfont.hxx b/vcl/inc/graphite_serverfont.hxx index 63adf526c2a1..b91616555cc6 100644 --- a/vcl/inc/graphite_serverfont.hxx +++ b/vcl/inc/graphite_serverfont.hxx @@ -95,7 +95,7 @@ public: virtual ~GraphiteServerFontLayout() throw(); - static bool IsGraphiteEnabledFont(ServerFont * pServerFont); + static bool IsGraphiteEnabledFont(ServerFont& rServerFont); // For use with PspGraphics const sal_Unicode* getTextPtr() const { return mpStr; }; int getMinCharPos() const { return mnMinCharPos; } diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx index d6cb49360682..e70b29debcbc 100644 --- a/vcl/source/glyphs/gcach_ftyp.hxx +++ b/vcl/source/glyphs/gcach_ftyp.hxx @@ -200,22 +200,22 @@ public: virtual const ImplFontCharMap* GetImplFontCharMap( void ) const; virtual int GetGlyphIndex( sal_UCS4 ) const; - int GetRawGlyphIndex( sal_UCS4 ) const; - int FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const; + virtual int GetRawGlyphIndex( sal_UCS4 ) const; + virtual int FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const; virtual bool GetAntialiasAdvice( void ) const; virtual bool GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const; virtual bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const; virtual bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const; virtual int GetGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const; - virtual sal_uLong GetKernPairs( ImplKernPairData** ) const; + virtual sal_uLong GetKernPairs( ImplKernPairData** ) const; - const unsigned char* GetTable( const char* pName, sal_uLong* pLength ) + virtual const unsigned char* GetTable( const char* pName, sal_uLong* pLength ) { return mpFontInfo->GetTable( pName, pLength ); } - int GetEmUnits() const; - const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; } + virtual int GetEmUnits() const; + virtual const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; } #ifdef ENABLE_GRAPHITE - GraphiteFaceWrapper* GetGraphiteFace() const { return mpFontInfo->GetGraphiteFace(); } + virtual GraphiteFaceWrapper* GetGraphiteFace() const { return mpFontInfo->GetGraphiteFace(); } #endif protected: diff --git a/vcl/source/glyphs/gcach_layout.cxx b/vcl/source/glyphs/gcach_layout.cxx index 311654586596..1ed28907771e 100644 --- a/vcl/source/glyphs/gcach_layout.cxx +++ b/vcl/source/glyphs/gcach_layout.cxx @@ -101,7 +101,7 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs ) bool ServerFontLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rArgs ) { - FreetypeServerFont& rFont = static_cast<FreetypeServerFont&>(rLayout.GetServerFont()); + ServerFont& rFont = rLayout.GetServerFont(); Point aNewPos( 0, 0 ); int nOldGlyphId = -1; @@ -193,10 +193,10 @@ class IcuFontFromServerFont : public LEFontInstance { private: - FreetypeServerFont& mrServerFont; + ServerFont& mrServerFont; public: - IcuFontFromServerFont( FreetypeServerFont& rFont ) + IcuFontFromServerFont( ServerFont& rFont ) : mrServerFont( rFont ) {} @@ -361,7 +361,7 @@ private: LayoutEngine* mpIcuLE; public: - IcuLayoutEngine( FreetypeServerFont& ); + IcuLayoutEngine( ServerFont& ); virtual ~IcuLayoutEngine(); virtual bool operator()( ServerFontLayout&, ImplLayoutArgs& ); @@ -369,7 +369,7 @@ public: // ----------------------------------------------------------------------- -IcuLayoutEngine::IcuLayoutEngine( FreetypeServerFont& rServerFont ) +IcuLayoutEngine::IcuLayoutEngine( ServerFont& rServerFont ) : maIcuFont( rServerFont ), meScriptCode( USCRIPT_INVALID_CODE ), mpIcuLE( NULL ) @@ -417,7 +417,7 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr le_int32* pCharIndices = (le_int32*)((char*)pIcuGlyphs + nGlyphCapacity * sizeof(LEGlyphID) ); IcuPosition* pGlyphPositions = (IcuPosition*)((char*)pCharIndices + nGlyphCapacity * sizeof(le_int32) ); - FreetypeServerFont& rFont = reinterpret_cast<FreetypeServerFont&>(rLayout.GetServerFont()); + ServerFont& rFont = rLayout.GetServerFont(); UErrorCode rcI18n = U_ZERO_ERROR; LEErrorCode rcIcu = LE_NO_ERROR; diff --git a/vcl/source/glyphs/graphite_serverfont.cxx b/vcl/source/glyphs/graphite_serverfont.cxx index 1f9ee322455a..a062b0ff6975 100644 --- a/vcl/source/glyphs/graphite_serverfont.cxx +++ b/vcl/source/glyphs/graphite_serverfont.cxx @@ -49,9 +49,9 @@ float freetypeServerFontAdvance(const void* appFontHandle, gr_uint16 glyphId) { - FreetypeServerFont * pServerFont = - const_cast<FreetypeServerFont*> - (reinterpret_cast<const FreetypeServerFont*>(appFontHandle)); + ServerFont * pServerFont = + const_cast<ServerFont*> + (reinterpret_cast<const ServerFont*>(appFontHandle)); if (pServerFont) { return static_cast<float>(pServerFont->GetGlyphMetric(glyphId).GetCharWidth()); @@ -63,23 +63,22 @@ float freetypeServerFontAdvance(const void* appFontHandle, gr_uint16 glyphId) // An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used. // -GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont & rServerFont) throw() +GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont& rServerFont) throw() : ServerFontLayout(rServerFont), - maImpl(dynamic_cast<FreetypeServerFont&>(rServerFont).GetGraphiteFace()->face(), + maImpl(rServerFont.GetGraphiteFace()->face(), rServerFont), mpFeatures(NULL) { - FreetypeServerFont& rFTServerFont = dynamic_cast<FreetypeServerFont&>(rServerFont); - gr_font * pFont = rFTServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight); + gr_font * pFont = rServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight); if (!pFont) { pFont = gr_make_font_with_advance_fn( // need to use mnHeight here, mfExactHeight can give wrong values static_cast<float>(rServerFont.GetFontSelData().mnHeight), - &rFTServerFont, + &rServerFont, freetypeServerFontAdvance, - rFTServerFont.GetGraphiteFace()->face()); - rFTServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont); + rServerFont.GetGraphiteFace()->face()); + rServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont); } maImpl.SetFont(pFont); rtl::OString aLang(""); @@ -92,7 +91,7 @@ GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont & rServerFont) thr rServerFont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 ); #ifdef DEBUG printf("GraphiteServerFontLayout %lx %s size %d %f\n", (long unsigned int)this, name.getStr(), - rFTServerFont.GetMetricsFT().x_ppem, + rServerFont.GetMetricsFT().x_ppem, rServerFont.GetFontSelData().mfExactHeight); #endif sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1; @@ -100,7 +99,7 @@ GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont & rServerFont) thr { rtl::OString aFeat = name.copy(nFeat, name.getLength() - nFeat); mpFeatures = new grutils::GrFeatureParser( - rFTServerFont.GetGraphiteFace()->face(), aFeat, aLang); + rServerFont.GetGraphiteFace()->face(), aFeat, aLang); #ifdef DEBUG if (mpFeatures) printf("GraphiteServerFontLayout %s/%s/%s %x language %d features %d errors\n", @@ -117,7 +116,7 @@ GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont & rServerFont) thr else { mpFeatures = new grutils::GrFeatureParser( - rFTServerFont.GetGraphiteFace()->face(), aLang); + rServerFont.GetGraphiteFace()->face(), aLang); } maImpl.SetFeatures(mpFeatures); } @@ -128,18 +127,14 @@ GraphiteServerFontLayout::~GraphiteServerFontLayout() throw() mpFeatures = NULL; } -bool GraphiteServerFontLayout::IsGraphiteEnabledFont(ServerFont * pServerFont) +bool GraphiteServerFontLayout::IsGraphiteEnabledFont(ServerFont& rServerFont) { - FreetypeServerFont * pFtServerFont = dynamic_cast<FreetypeServerFont*>(pServerFont); - if (pFtServerFont) + if (rServerFont.GetGraphiteFace()) { - if (pFtServerFont->GetGraphiteFace()) - { #ifdef DEBUG - printf("IsGraphiteEnabledFont\n"); + printf("IsGraphiteEnabledFont\n"); #endif - return true; - } + return true; } return false; } diff --git a/vcl/unx/generic/gdi/pspgraphics.cxx b/vcl/unx/generic/gdi/pspgraphics.cxx index f5546da6e785..a75ec2e5b30e 100644 --- a/vcl/unx/generic/gdi/pspgraphics.cxx +++ b/vcl/unx/generic/gdi/pspgraphics.cxx @@ -991,7 +991,7 @@ SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel { #ifdef ENABLE_GRAPHITE // Is this a Graphite font? - if (GraphiteServerFontLayout::IsGraphiteEnabledFont(m_pServerFont[nFallbackLevel])) + if (GraphiteServerFontLayout::IsGraphiteEnabledFont(*m_pServerFont[nFallbackLevel])) { pLayout = new GraphiteServerFontLayout(*m_pServerFont[nFallbackLevel]); } diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx index 023f64bb5e7c..1b33ba4e1860 100644 --- a/vcl/unx/generic/gdi/salgdi3.cxx +++ b/vcl/unx/generic/gdi/salgdi3.cxx @@ -1101,7 +1101,7 @@ SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe #ifdef ENABLE_GRAPHITE // Is this a Graphite font? if (!bDisableGraphite_ && - GraphiteServerFontLayout::IsGraphiteEnabledFont(mpServerFont[nFallbackLevel])) + GraphiteServerFontLayout::IsGraphiteEnabledFont(*mpServerFont[nFallbackLevel])) { pLayout = new GraphiteServerFontLayout(*mpServerFont[nFallbackLevel]); } |