Kaydet (Commit) 8e64e571 authored tarafından Caolán McNamara's avatar Caolán McNamara

Merge FreetypeServerFont and ServerFont now its split out into unx

üst 2f800d90
......@@ -183,69 +183,74 @@ private:
// =======================================================================
class FtFontInfo;
class VCL_PLUGIN_PUBLIC ServerFont
{
public:
virtual const ::rtl::OString* GetFontFileName() const = 0;
virtual int GetFontFaceNumber() const = 0;
virtual bool TestFont() const = 0;
virtual void* GetFtFace() const = 0;
virtual int GetLoadFlags() const = 0;
virtual void SetFontOptions( boost::shared_ptr<ImplFontOptions> ) = 0;
virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const = 0;
virtual bool NeedsArtificialBold() const = 0;
virtual bool NeedsArtificialItalic() const = 0;
ServerFont( const ImplFontSelectData&, FtFontInfo* );
virtual ~ServerFont();
const ::rtl::OString* GetFontFileName() const;
int GetFontFaceNumber() const;
bool TestFont() const;
void* GetFtFace() const;
int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
void SetFontOptions( boost::shared_ptr<ImplFontOptions> );
boost::shared_ptr<ImplFontOptions> GetFontOptions() const;
bool NeedsArtificialBold() const { return mbArtBold; }
bool NeedsArtificialItalic() const { return mbArtItalic; }
const ImplFontSelectData& GetFontSelData() const { return maFontSelData; }
virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) 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;
void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const;
sal_uLong GetKernPairs( ImplKernPairData** ) const;
const unsigned char* GetTable( const char* pName, sal_uLong* pLength );
int GetEmUnits() const;
const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; }
int GetGlyphKernValue( int, int ) const;
const ImplFontCharMap* GetImplFontCharMap() const;
bool GetFontCapabilities(vcl::FontCapabilities &) const;
Point TransformPoint( const Point& ) const;
GlyphData& GetGlyphData( int nGlyphIndex );
const GlyphMetric& GetGlyphMetric( int nGlyphIndex )
{ return GetGlyphData( nGlyphIndex ).GetMetric(); }
#ifdef ENABLE_GRAPHITE
virtual GraphiteFaceWrapper* GetGraphiteFace() const = 0;
virtual GraphiteFaceWrapper* GetGraphiteFace() const;
#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;
int GetGlyphIndex( sal_UCS4 ) const;
int GetRawGlyphIndex( sal_UCS4 ) const;
int FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const;
bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const;
bool GetAntialiasAdvice( void ) const;
bool IsGlyphInvisible( int nGlyphIndex );
virtual bool GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const = 0;
virtual bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const = 0;
bool GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const;
bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const;
void SetExtended( int nInfo, void* ppVoid );
int GetExtInfo() { return mnExtInfo; }
void* GetExtPointer() { return mpExtData; }
protected:
private:
friend class GlyphCache;
friend class ServerFontLayout;
explicit ServerFont( const ImplFontSelectData& );
virtual ~ServerFont();
void AddRef() const { ++mnRefCount; }
long GetRefCount() const { return mnRefCount; }
long Release() const;
sal_uLong GetByteCount() const { return mnBytesUsed; }
virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const = 0;
virtual void GarbageCollect( long );
void InitGlyphData( int nGlyphIndex, GlyphData& ) const;
void GarbageCollect( long );
void ReleaseFromGarbageCollect();
virtual ServerFontLayoutEngine* GetLayoutEngine() = 0;
int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const;
bool ApplyGSUB( const ImplFontSelectData& );
ServerFontLayoutEngine* GetLayoutEngine();
private:
typedef ::boost::unordered_map<int,GlyphData> GlyphList;
mutable GlyphList maGlyphList;
......@@ -262,14 +267,36 @@ private:
ServerFont* mpPrevGCFont;
ServerFont* mpNextGCFont;
protected:
// 16.16 fixed point values used for a rotated font
long mnCos;
long mnSin;
private:
int mnZWJ;
int mnZWNJ;
bool mbCollectedZW;
int mnWidth;
int mnPrioEmbedded;
int mnPrioAntiAlias;
int mnPrioAutoHint;
FtFontInfo* mpFontInfo;
FT_Int mnLoadFlags;
double mfStretch;
FT_FaceRec_* maFaceFT;
FT_SizeRec_* maSizeFT;
boost::shared_ptr<ImplFontOptions> mpFontOptions;
bool mbFaceOk;
bool mbArtItalic;
bool mbArtBold;
bool mbUseGamma;
typedef ::boost::unordered_map<int,int> GlyphSubstitution;
GlyphSubstitution maGlyphSubstitution;
rtl_UnicodeToTextConverter maRecodeConverter;
ServerFontLayoutEngine* mpLayoutEngine;
};
// =======================================================================
......
......@@ -164,7 +164,7 @@ public:
void AnnounceFonts( ImplDevFontList* ) const;
void ClearFontList();
FreetypeServerFont* CreateFont( const ImplFontSelectData& );
ServerFont* CreateFont( const ImplFontSelectData& );
private:
typedef ::boost::unordered_map<sal_IntPtr,FtFontInfo*> FontList;
......@@ -176,80 +176,6 @@ private:
// -----------------------------------------------------------------------
class FreetypeServerFont : public ServerFont
{
public:
FreetypeServerFont( const ImplFontSelectData&, FtFontInfo* );
virtual ~FreetypeServerFont();
virtual const ::rtl::OString* GetFontFileName() const { return mpFontInfo->GetFontFileName(); }
virtual int GetFontFaceNumber() const { return mpFontInfo->GetFaceNum(); }
virtual bool TestFont() const;
virtual void* GetFtFace() const;
virtual void SetFontOptions( boost::shared_ptr<ImplFontOptions> );
virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const;
virtual int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
virtual bool NeedsArtificialBold() const { return mbArtBold; }
virtual bool NeedsArtificialItalic() const { return mbArtItalic; }
virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const;
virtual const ImplFontCharMap* GetImplFontCharMap( void ) const;
virtual int GetGlyphIndex( 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 const unsigned char* GetTable( const char* pName, sal_uLong* pLength )
{ return mpFontInfo->GetTable( pName, pLength ); }
virtual int GetEmUnits() const;
virtual const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; }
#ifdef ENABLE_GRAPHITE
virtual GraphiteFaceWrapper* GetGraphiteFace() const { return mpFontInfo->GetGraphiteFace(); }
#endif
protected:
friend class GlyphCache;
int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const;
virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const;
virtual bool GetFontCapabilities(vcl::FontCapabilities &) const;
bool ApplyGSUB( const ImplFontSelectData& );
virtual ServerFontLayoutEngine* GetLayoutEngine();
private:
int mnWidth;
int mnPrioEmbedded;
int mnPrioAntiAlias;
int mnPrioAutoHint;
FtFontInfo* mpFontInfo;
FT_Int mnLoadFlags;
double mfStretch;
FT_FaceRec_* maFaceFT;
FT_SizeRec_* maSizeFT;
boost::shared_ptr<ImplFontOptions> mpFontOptions;
bool mbFaceOk;
bool mbArtItalic;
bool mbArtBold;
bool mbUseGamma;
typedef ::boost::unordered_map<int,int> GlyphSubstitution;
GlyphSubstitution maGlyphSubstitution;
rtl_UnicodeToTextConverter maRecodeConverter;
ServerFontLayoutEngine* mpLayoutEngine;
};
// -----------------------------------------------------------------------
class ImplFTSFontData : public ImplFontData
{
private:
......
......@@ -653,7 +653,7 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr
// =======================================================================
ServerFontLayoutEngine* FreetypeServerFont::GetLayoutEngine()
ServerFontLayoutEngine* ServerFont::GetLayoutEngine()
{
// find best layout engine for font, platform, script and language
#ifdef ENABLE_ICU_LAYOUT
......
......@@ -345,43 +345,6 @@ inline void GlyphCache::RemovingGlyph( ServerFont& rSF, GlyphData& rGD, int nGly
--mnGlyphCount;
}
// =======================================================================
// ServerFont
// =======================================================================
ServerFont::ServerFont( const ImplFontSelectData& rFSD )
: maGlyphList( 0),
maFontSelData(rFSD),
mnExtInfo(0),
mnRefCount(1),
mnBytesUsed( sizeof(ServerFont) ),
mpPrevGCFont( NULL ),
mpNextGCFont( NULL ),
mnCos( 0x10000),
mnSin( 0 ),
mnZWJ( 0 ),
mnZWNJ( 0 ),
mbCollectedZW( false )
{
// TODO: move update of mpFontEntry into FontEntry class when
// it becomes reponsible for the ServerFont instantiation
((ImplServerFontEntry*)rFSD.mpFontEntry)->SetServerFont( this );
if( rFSD.mnOrientation != 0 )
{
const double dRad = rFSD.mnOrientation * ( F_2PI / 3600.0 );
mnCos = static_cast<long>( 0x10000 * cos( dRad ) + 0.5 );
mnSin = static_cast<long>( 0x10000 * sin( dRad ) + 0.5 );
}
}
// -----------------------------------------------------------------------
ServerFont::~ServerFont()
{
ReleaseFromGarbageCollect();
}
// -----------------------------------------------------------------------
void ServerFont::ReleaseFromGarbageCollect()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment