Rename ServerFont to FreetypeFont
This is what it is actually is, we dropped support for server-side fonts for a long time now. Renamed also a few related classes, but left ServerFontLayout* ones as they will go away soonish. Change-Id: I68a6dad51b6972368b7bf85a0b9c8089cc12740e Reviewed-on: https://gerrit.libreoffice.org/30390 Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Tested-by: Khaled Hosny <khaledhosny@eglug.org>
This commit is contained in:
parent
be1750d866
commit
0fd8ef082d
@ -161,7 +161,7 @@ bool FpComparison::ignore(FunctionDecl* function)
|
||||
|| dc.Function("ImplWrite").Class("EMFWriter").GlobalNamespace()
|
||||
|| dc.Function("WriteRecords").Class("WMFWriter").GlobalNamespace()
|
||||
|| dc.Function("convertOneTypeEsc").Class("CffSubsetterContext").GlobalNamespace()
|
||||
|| dc.Function("ApplyGlyphTransform").Class("ServerFont").GlobalNamespace()
|
||||
|| dc.Function("ApplyGlyphTransform").Class("FreetypeFont").GlobalNamespace()
|
||||
|| dc.Function("JoinVerticalClipRectangles").Class("PrinterGfx").Namespace("psp").GlobalNamespace()
|
||||
|| dc.Function("PSSetLineWidth").Class("PrinterGfx").Namespace("psp").GlobalNamespace()
|
||||
|| dc.Function("DrawEPS").Class("PrinterGfx").Namespace("psp").GlobalNamespace()
|
||||
|
@ -117,9 +117,9 @@ SalLayout* SvpSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
|
||||
return m_aTextRenderImpl.GetTextLayout(rArgs, nFallbackLevel);
|
||||
}
|
||||
|
||||
void SvpSalGraphics::DrawServerFontLayout( const GenericSalLayout& rSalLayout, const ServerFont& rServerFont )
|
||||
void SvpSalGraphics::DrawServerFontLayout( const GenericSalLayout& rSalLayout, const FreetypeFont& rFreetypeFont )
|
||||
{
|
||||
m_aTextRenderImpl.DrawServerFontLayout( rSalLayout, rServerFont );
|
||||
m_aTextRenderImpl.DrawServerFontLayout( rSalLayout, rFreetypeFont );
|
||||
}
|
||||
|
||||
void SvpSalGraphics::DrawSalLayout( const CommonSalLayout& rSalLayout )
|
||||
|
@ -46,7 +46,7 @@ class CommonSalLayout : public GenericSalLayout
|
||||
#elif defined(MACOSX) || defined(IOS)
|
||||
const CoreTextStyle& mrCoreTextStyle;
|
||||
#else
|
||||
ServerFont& mrServerFont;
|
||||
FreetypeFont& mrFreetypeFont;
|
||||
#endif
|
||||
|
||||
void ParseFeatures(const OUString& name);
|
||||
@ -61,8 +61,8 @@ public:
|
||||
explicit CommonSalLayout(const CoreTextStyle&);
|
||||
const CoreTextStyle& getFontData() const { return mrCoreTextStyle; };
|
||||
#else
|
||||
explicit CommonSalLayout(ServerFont&);
|
||||
const ServerFont& getFontData() const { return mrServerFont; };
|
||||
explicit CommonSalLayout(FreetypeFont&);
|
||||
const FreetypeFont& getFontData() const { return mrFreetypeFont; };
|
||||
#endif
|
||||
|
||||
void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool);
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "sallayout.hxx"
|
||||
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
class PhysicalFontFace;
|
||||
|
||||
namespace grutils { class GrFeatureParser; }
|
||||
|
@ -36,12 +36,12 @@ class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
|
||||
{
|
||||
public:
|
||||
GraphiteLayoutImpl(const gr_face * pFace,
|
||||
ServerFont & rServerFont) throw()
|
||||
: GraphiteLayout(pFace), mrServerFont(rServerFont) {};
|
||||
FreetypeFont & rFreetypeFont) throw()
|
||||
: GraphiteLayout(pFace), mrFreetypeFont(rFreetypeFont) {};
|
||||
virtual ~GraphiteLayoutImpl() throw() override {};
|
||||
virtual sal_GlyphId getKashidaGlyph(int & width) override;
|
||||
private:
|
||||
ServerFont & mrServerFont;
|
||||
FreetypeFont & mrFreetypeFont;
|
||||
};
|
||||
|
||||
// This class implments the server font specific parts.
|
||||
@ -54,7 +54,7 @@ private:
|
||||
mutable GraphiteLayoutImpl maImpl;
|
||||
grutils::GrFeatureParser * mpFeatures;
|
||||
public:
|
||||
GraphiteServerFontLayout(ServerFont& pServerFont) throw();
|
||||
GraphiteServerFontLayout(FreetypeFont& pFreetypeFont) throw();
|
||||
|
||||
virtual bool LayoutText( ImplLayoutArgs& rArgs) override
|
||||
{
|
||||
@ -101,7 +101,7 @@ public:
|
||||
|
||||
virtual ~GraphiteServerFontLayout() throw() override;
|
||||
|
||||
static bool IsGraphiteEnabledFont(ServerFont& rServerFont);
|
||||
static bool IsGraphiteEnabledFont(FreetypeFont& rFreetypeFont);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
struct BitmapBuffer;
|
||||
class GlyphCache;
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
typedef struct _cairo cairo_t;
|
||||
typedef struct _cairo_surface cairo_surface_t;
|
||||
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
||||
@ -167,7 +167,7 @@ public:
|
||||
virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) override;
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawSalLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override;
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
virtual void drawPixel( long nX, long nY ) override;
|
||||
virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override;
|
||||
|
@ -407,7 +407,7 @@ public:
|
||||
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawSalLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) override {};
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override {};
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
|
||||
#ifdef MACOSX
|
||||
|
@ -43,7 +43,7 @@ class Rectangle;
|
||||
class FontSubsetInfo;
|
||||
class OpenGLContext;
|
||||
class OutputDevice;
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
class CommonSalLayout;
|
||||
struct SystemGraphicsData;
|
||||
|
||||
@ -218,7 +218,7 @@ public:
|
||||
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
|
||||
virtual void DrawSalLayout( const CommonSalLayout& ) = 0;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) = 0;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) = 0;
|
||||
|
||||
virtual bool supportsOperation( OutDevSupportType ) const = 0;
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) = 0;
|
||||
virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) = 0;
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) = 0;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) = 0;
|
||||
#if ENABLE_CAIRO_CANVAS
|
||||
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const = 0;
|
||||
#endif // ENABLE_CAIRO_CANVAS
|
||||
|
@ -26,13 +26,13 @@
|
||||
|
||||
#include <deque>
|
||||
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
class GlyphCache;
|
||||
typedef struct _cairo cairo_t;
|
||||
|
||||
class VCL_DLLPUBLIC CairoTextRender : public TextRenderImpl
|
||||
{
|
||||
ServerFont* mpServerFont[ MAX_FALLBACK ];
|
||||
FreetypeFont* mpFreetypeFont[ MAX_FALLBACK ];
|
||||
|
||||
SalColor mnTextColor;
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) override;
|
||||
virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) override;
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override;
|
||||
#if ENABLE_CAIRO_CANVAS
|
||||
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
|
||||
#endif
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
void AnnounceFonts( PhysicalFontCollection* ) const;
|
||||
void ClearFontList();
|
||||
|
||||
ServerFont* CreateFont( const FontSelectPattern& );
|
||||
FreetypeFont* CreateFont( const FontSelectPattern& );
|
||||
|
||||
private:
|
||||
typedef std::unordered_map<sal_IntPtr,FreetypeFontInfo*> FontList;
|
||||
|
@ -33,7 +33,7 @@ class PhysicalFontCollection;
|
||||
|
||||
namespace psp { struct JobData; class PrinterGfx; }
|
||||
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
class ServerFontLayout;
|
||||
class FontAttributes;
|
||||
class SalInfoPrinter;
|
||||
@ -46,7 +46,7 @@ class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics
|
||||
psp::JobData* m_pJobData;
|
||||
psp::PrinterGfx* m_pPrinterGfx;
|
||||
|
||||
ServerFont* m_pServerFont[ MAX_FALLBACK ];
|
||||
FreetypeFont* m_pFreetypeFont[ MAX_FALLBACK ];
|
||||
bool m_bFontVertical;
|
||||
SalInfoPrinter* m_pInfoPrinter;
|
||||
public:
|
||||
@ -133,7 +133,7 @@ public:
|
||||
virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) override;
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawSalLayout( const CommonSalLayout& ) override {};
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override;
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
virtual void drawPixel( long nX, long nY ) override;
|
||||
virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override;
|
||||
|
@ -45,7 +45,7 @@ class GlyphData;
|
||||
class GraphiteFaceWrapper;
|
||||
class FontConfigFontOptions;
|
||||
class PhysicalFontCollection;
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
class ServerFontLayout;
|
||||
class ServerFontLayoutEngine;
|
||||
class SvpGcpHelper;
|
||||
@ -68,17 +68,17 @@ public:
|
||||
|
||||
void AnnounceFonts( PhysicalFontCollection* ) const;
|
||||
|
||||
ServerFont* CacheFont( const FontSelectPattern& );
|
||||
void UncacheFont( ServerFont& );
|
||||
FreetypeFont* CacheFont( const FontSelectPattern& );
|
||||
void UncacheFont( FreetypeFont& );
|
||||
void ClearFontCache();
|
||||
void InvalidateAllGlyphs();
|
||||
|
||||
private:
|
||||
friend class ServerFont;
|
||||
// used by ServerFont class only
|
||||
void AddedGlyph( ServerFont&, GlyphData& );
|
||||
friend class FreetypeFont;
|
||||
// used by FreetypeFont class only
|
||||
void AddedGlyph( FreetypeFont&, GlyphData& );
|
||||
void RemovingGlyph();
|
||||
void UsingGlyph( ServerFont&, GlyphData& );
|
||||
void UsingGlyph( FreetypeFont&, GlyphData& );
|
||||
|
||||
private:
|
||||
void GarbageCollect();
|
||||
@ -87,14 +87,14 @@ private:
|
||||
// the FontList key's mpFontData member is reinterpreted as integer font id
|
||||
struct IFSD_Equal{ bool operator()( const FontSelectPattern&, const FontSelectPattern& ) const; };
|
||||
struct IFSD_Hash{ size_t operator()( const FontSelectPattern& ) const; };
|
||||
typedef std::unordered_map<FontSelectPattern,ServerFont*,IFSD_Hash,IFSD_Equal > FontList;
|
||||
typedef std::unordered_map<FontSelectPattern,FreetypeFont*,IFSD_Hash,IFSD_Equal > FontList;
|
||||
|
||||
FontList maFontList;
|
||||
sal_uLong mnMaxSize; // max overall cache size in bytes
|
||||
mutable sal_uLong mnBytesUsed;
|
||||
mutable long mnLruIndex;
|
||||
mutable int mnGlyphCount;
|
||||
ServerFont* mpCurrentGCFont;
|
||||
FreetypeFont* mpCurrentGCFont;
|
||||
|
||||
FreetypeManager* mpFtManager;
|
||||
};
|
||||
@ -144,11 +144,11 @@ private:
|
||||
mutable long mnLruValue;
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC ServerFont
|
||||
class VCL_DLLPUBLIC FreetypeFont
|
||||
{
|
||||
public:
|
||||
ServerFont( const FontSelectPattern&, FreetypeFontInfo* );
|
||||
virtual ~ServerFont();
|
||||
FreetypeFont( const FontSelectPattern&, FreetypeFontInfo* );
|
||||
virtual ~FreetypeFont();
|
||||
|
||||
const OString& GetFontFileName() const;
|
||||
bool TestFont() const { return mbFaceOk;}
|
||||
@ -187,7 +187,7 @@ public:
|
||||
private:
|
||||
friend class GlyphCache;
|
||||
friend class ServerFontLayout;
|
||||
friend class ServerFontInstance;
|
||||
friend class FreetypeFontInstance;
|
||||
friend class X11SalGraphics;
|
||||
friend class CairoTextRender;
|
||||
|
||||
@ -214,8 +214,8 @@ private:
|
||||
mutable long mnRefCount;
|
||||
mutable sal_uLong mnBytesUsed;
|
||||
|
||||
ServerFont* mpPrevGCFont;
|
||||
ServerFont* mpNextGCFont;
|
||||
FreetypeFont* mpPrevGCFont;
|
||||
FreetypeFont* mpNextGCFont;
|
||||
|
||||
// 16.16 fixed point values used for a rotated font
|
||||
long mnCos;
|
||||
@ -246,17 +246,17 @@ private:
|
||||
};
|
||||
|
||||
// a class for cache entries for physical font instances that are based on serverfonts
|
||||
class VCL_DLLPUBLIC ServerFontInstance : public LogicalFontInstance
|
||||
class VCL_DLLPUBLIC FreetypeFontInstance : public LogicalFontInstance
|
||||
{
|
||||
public:
|
||||
ServerFontInstance( FontSelectPattern& );
|
||||
virtual ~ServerFontInstance() override;
|
||||
FreetypeFontInstance( FontSelectPattern& );
|
||||
virtual ~FreetypeFontInstance() override;
|
||||
|
||||
void SetServerFont(ServerFont* p);
|
||||
void SetFreetypeFont(FreetypeFont* p);
|
||||
void HandleFontOptions();
|
||||
|
||||
private:
|
||||
ServerFont* mpServerFont;
|
||||
FreetypeFont* mpFreetypeFont;
|
||||
std::shared_ptr<FontConfigFontOptions> mxFontOptions;
|
||||
bool mbGotFontOptions;
|
||||
|
||||
@ -265,7 +265,7 @@ private:
|
||||
class VCL_DLLPUBLIC ServerFontLayout : public GenericSalLayout
|
||||
{
|
||||
public:
|
||||
ServerFontLayout( ServerFont& );
|
||||
ServerFontLayout( FreetypeFont& );
|
||||
|
||||
virtual bool LayoutText( ImplLayoutArgs& ) override;
|
||||
virtual void AdjustLayout( ImplLayoutArgs& ) override;
|
||||
@ -276,13 +276,13 @@ public:
|
||||
sal_Int32 nIndex,
|
||||
bool bRightToLeft);
|
||||
|
||||
ServerFont& GetServerFont() const { return mrServerFont; }
|
||||
FreetypeFont& GetFreetypeFont() const { return mrFreetypeFont; }
|
||||
|
||||
virtual std::shared_ptr<vcl::TextLayoutCache>
|
||||
CreateTextLayoutCache(OUString const&) const override;
|
||||
|
||||
private:
|
||||
ServerFont& mrServerFont;
|
||||
FreetypeFont& mrFreetypeFont;
|
||||
css::uno::Reference<css::i18n::XBreakIterator> mxBreak;
|
||||
|
||||
ServerFontLayout( const ServerFontLayout& ) = delete;
|
||||
|
@ -52,7 +52,7 @@ class X11SalVirtualDevice;
|
||||
class X11SalGraphicsImpl;
|
||||
class X11OpenGLSalGraphicsImpl;
|
||||
class X11OpenGLSalVirtualDevice;
|
||||
class ServerFont;
|
||||
class FreetypeFont;
|
||||
class ImplLayoutArgs;
|
||||
class ServerFontLayout;
|
||||
class PhysicalFontCollection;
|
||||
@ -155,7 +155,7 @@ public:
|
||||
virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) override;
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawSalLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override;
|
||||
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
virtual void drawPixel( long nX, long nY ) override;
|
||||
|
@ -458,7 +458,7 @@ public:
|
||||
|
||||
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawSalLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const ServerFont& ) override {};
|
||||
virtual void DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override {};
|
||||
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
// Query the platform layer for control support
|
||||
|
@ -61,7 +61,7 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
|
||||
}
|
||||
#else
|
||||
const unsigned char* pBuffer = nullptr;
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pUserData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pUserData);
|
||||
pBuffer = pFont->GetTable(pTagName, &nLength);
|
||||
#endif
|
||||
|
||||
@ -213,17 +213,17 @@ CommonSalLayout::CommonSalLayout(const CoreTextStyle& rCoreTextStyle)
|
||||
}
|
||||
|
||||
#else
|
||||
CommonSalLayout::CommonSalLayout(ServerFont& rServerFont)
|
||||
: mrFontSelData(rServerFont.GetFontSelData()),
|
||||
mrServerFont(rServerFont)
|
||||
CommonSalLayout::CommonSalLayout(FreetypeFont& rFreetypeFont)
|
||||
: mrFontSelData(rFreetypeFont.GetFontSelData()),
|
||||
mrFreetypeFont(rFreetypeFont)
|
||||
{
|
||||
mpHbFont = rServerFont.GetHbFont();
|
||||
mpHbFont = rFreetypeFont.GetHbFont();
|
||||
if (!mpHbFont)
|
||||
{
|
||||
hb_face_t* pHbFace = hb_face_create_for_tables(getFontTable, &rServerFont, nullptr);
|
||||
hb_face_t* pHbFace = hb_face_create_for_tables(getFontTable, &rFreetypeFont, nullptr);
|
||||
|
||||
mpHbFont = createHbFont(pHbFace);
|
||||
mrServerFont.SetHbFont(mpHbFont);
|
||||
mrFreetypeFont.SetHbFont(mpHbFont);
|
||||
|
||||
hb_face_destroy(pHbFace);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts;
|
||||
CairoTextRender::CairoTextRender()
|
||||
: mnTextColor(MAKE_SALCOLOR(0x00, 0x00, 0x00)) //black
|
||||
{
|
||||
for(ServerFont* & rp : mpServerFont)
|
||||
for(FreetypeFont* & rp : mpFreetypeFont)
|
||||
rp = nullptr;
|
||||
|
||||
#if ENABLE_GRAPHITE
|
||||
@ -98,11 +98,11 @@ bool CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLev
|
||||
// release all no longer needed font resources
|
||||
for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
|
||||
{
|
||||
if( mpServerFont[i] != nullptr )
|
||||
if( mpFreetypeFont[i] != nullptr )
|
||||
{
|
||||
// old server side font is no longer referenced
|
||||
GlyphCache::GetInstance().UncacheFont( *mpServerFont[i] );
|
||||
mpServerFont[i] = nullptr;
|
||||
GlyphCache::GetInstance().UncacheFont( *mpFreetypeFont[i] );
|
||||
mpFreetypeFont[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,21 +115,21 @@ bool CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLev
|
||||
return false;
|
||||
|
||||
// handle the request for a non-native X11-font => use the GlyphCache
|
||||
ServerFont* pServerFont = GlyphCache::GetInstance().CacheFont( *pEntry );
|
||||
if( pServerFont != nullptr )
|
||||
FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont( *pEntry );
|
||||
if( pFreetypeFont != nullptr )
|
||||
{
|
||||
// ignore fonts with e.g. corrupted font files
|
||||
if( !pServerFont->TestFont() )
|
||||
if( !pFreetypeFont->TestFont() )
|
||||
{
|
||||
GlyphCache::GetInstance().UncacheFont( *pServerFont );
|
||||
GlyphCache::GetInstance().UncacheFont( *pFreetypeFont );
|
||||
return false;
|
||||
}
|
||||
|
||||
// register to use the font
|
||||
mpServerFont[ nFallbackLevel ] = pServerFont;
|
||||
mpFreetypeFont[ nFallbackLevel ] = pFreetypeFont;
|
||||
|
||||
// apply font specific-hint settings
|
||||
ServerFontInstance* pSFE = static_cast<ServerFontInstance*>( pEntry->mpFontInstance );
|
||||
FreetypeFontInstance* pSFE = static_cast<FreetypeFontInstance*>( pEntry->mpFontInstance );
|
||||
pSFE->HandleFontOptions();
|
||||
|
||||
return true;
|
||||
@ -140,9 +140,9 @@ bool CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLev
|
||||
|
||||
FontConfigFontOptions* GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize);
|
||||
|
||||
void ServerFontInstance::HandleFontOptions()
|
||||
void FreetypeFontInstance::HandleFontOptions()
|
||||
{
|
||||
if( !mpServerFont )
|
||||
if( !mpFreetypeFont )
|
||||
return;
|
||||
if( !mbGotFontOptions )
|
||||
{
|
||||
@ -152,7 +152,7 @@ void ServerFontInstance::HandleFontOptions()
|
||||
maFontSelData.mnHeight ));
|
||||
}
|
||||
// apply the font options
|
||||
mpServerFont->SetFontOptions(mxFontOptions);
|
||||
mpFreetypeFont->SetFontOptions(mxFontOptions);
|
||||
}
|
||||
|
||||
void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId)
|
||||
@ -187,7 +187,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, const ServerFont& rFont )
|
||||
void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, const FreetypeFont& rFont )
|
||||
{
|
||||
std::vector<cairo_glyph_t> cairo_glyphs;
|
||||
std::vector<int> glyph_extrarotation;
|
||||
@ -371,18 +371,18 @@ void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, con
|
||||
|
||||
const FontCharMapRef CairoTextRender::GetFontCharMap() const
|
||||
{
|
||||
if( !mpServerFont[0] )
|
||||
if( !mpFreetypeFont[0] )
|
||||
return nullptr;
|
||||
|
||||
const FontCharMapRef xFCMap = mpServerFont[0]->GetFontCharMap();
|
||||
const FontCharMapRef xFCMap = mpFreetypeFont[0]->GetFontCharMap();
|
||||
return xFCMap;
|
||||
}
|
||||
|
||||
bool CairoTextRender::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCapabilities) const
|
||||
{
|
||||
if (!mpServerFont[0])
|
||||
if (!mpFreetypeFont[0])
|
||||
return false;
|
||||
return mpServerFont[0]->GetFontCapabilities(rGetImplFontCapabilities);
|
||||
return mpFreetypeFont[0]->GetFontCapabilities(rGetImplFontCapabilities);
|
||||
}
|
||||
|
||||
// SalGraphics
|
||||
@ -475,10 +475,10 @@ CairoTextRender::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFallba
|
||||
if( nFallbackLevel >= MAX_FALLBACK )
|
||||
return;
|
||||
|
||||
if( mpServerFont[nFallbackLevel] != nullptr )
|
||||
if( mpFreetypeFont[nFallbackLevel] != nullptr )
|
||||
{
|
||||
long rDummyFactor;
|
||||
mpServerFont[nFallbackLevel]->GetFontMetric( rxFontMetric, rDummyFactor );
|
||||
mpFreetypeFont[nFallbackLevel]->GetFontMetric( rxFontMetric, rDummyFactor );
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ bool CairoTextRender::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect
|
||||
if( nLevel >= MAX_FALLBACK )
|
||||
return false;
|
||||
|
||||
ServerFont* pSF = mpServerFont[ nLevel ];
|
||||
FreetypeFont* pSF = mpFreetypeFont[ nLevel ];
|
||||
if( !pSF )
|
||||
return false;
|
||||
|
||||
@ -519,7 +519,7 @@ bool CairoTextRender::GetGlyphOutline( sal_GlyphId aGlyphId,
|
||||
if( nLevel >= MAX_FALLBACK )
|
||||
return false;
|
||||
|
||||
ServerFont* pSF = mpServerFont[ nLevel ];
|
||||
FreetypeFont* pSF = mpFreetypeFont[ nLevel ];
|
||||
if( !pSF )
|
||||
return false;
|
||||
|
||||
@ -534,25 +534,25 @@ SalLayout* CairoTextRender::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackL
|
||||
{
|
||||
SalLayout* pLayout = nullptr;
|
||||
|
||||
if( mpServerFont[ nFallbackLevel ]
|
||||
if( mpFreetypeFont[ nFallbackLevel ]
|
||||
&& !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) )
|
||||
{
|
||||
if (SalLayout::UseCommonLayout())
|
||||
{
|
||||
pLayout = new CommonSalLayout(*mpServerFont[nFallbackLevel]);
|
||||
pLayout = new CommonSalLayout(*mpFreetypeFont[nFallbackLevel]);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ENABLE_GRAPHITE
|
||||
// Is this a Graphite font?
|
||||
if (!bDisableGraphite_ &&
|
||||
GraphiteServerFontLayout::IsGraphiteEnabledFont(*mpServerFont[nFallbackLevel]))
|
||||
GraphiteServerFontLayout::IsGraphiteEnabledFont(*mpFreetypeFont[nFallbackLevel]))
|
||||
{
|
||||
pLayout = new GraphiteServerFontLayout(*mpServerFont[nFallbackLevel]);
|
||||
pLayout = new GraphiteServerFontLayout(*mpFreetypeFont[nFallbackLevel]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
pLayout = new ServerFontLayout( *mpServerFont[ nFallbackLevel ] );
|
||||
pLayout = new ServerFontLayout( *mpFreetypeFont[ nFallbackLevel ] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,9 +567,9 @@ SystemFontData CairoTextRender::GetSysFontData( int nFallbackLevel ) const
|
||||
if (nFallbackLevel >= MAX_FALLBACK) nFallbackLevel = MAX_FALLBACK - 1;
|
||||
if (nFallbackLevel < 0 ) nFallbackLevel = 0;
|
||||
|
||||
if (mpServerFont[nFallbackLevel] != nullptr)
|
||||
if (mpFreetypeFont[nFallbackLevel] != nullptr)
|
||||
{
|
||||
ServerFont* rFont = mpServerFont[nFallbackLevel];
|
||||
FreetypeFont* rFont = mpFreetypeFont[nFallbackLevel];
|
||||
aSysFontData.nFontId = rFont->GetFtFace();
|
||||
aSysFontData.nFontFlags = rFont->GetLoadFlags();
|
||||
aSysFontData.bFakeBold = rFont->NeedsArtificialBold();
|
||||
|
@ -53,9 +53,9 @@ X11SalGraphics::GetFontGC()
|
||||
return pFontGC_;
|
||||
}
|
||||
|
||||
void X11SalGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, const ServerFont& rServerFont )
|
||||
void X11SalGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, const FreetypeFont& rFreetypeFont )
|
||||
{
|
||||
mxTextRenderImpl->DrawServerFontLayout(rLayout, rServerFont);
|
||||
mxTextRenderImpl->DrawServerFontLayout(rLayout, rFreetypeFont);
|
||||
}
|
||||
|
||||
void X11SalGraphics::DrawSalLayout( const CommonSalLayout& rLayout )
|
||||
|
@ -360,7 +360,7 @@ FreetypeManager::FreetypeManager()
|
||||
vclFontFileList::get();
|
||||
}
|
||||
|
||||
FT_Face ServerFont::GetFtFace() const
|
||||
FT_Face FreetypeFont::GetFtFace() const
|
||||
{
|
||||
FT_Activate_Size( maSizeFT );
|
||||
|
||||
@ -407,7 +407,7 @@ void FreetypeManager::ClearFontList( )
|
||||
maFontList.clear();
|
||||
}
|
||||
|
||||
ServerFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD )
|
||||
FreetypeFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD )
|
||||
{
|
||||
FreetypeFontInfo* pFontInfo = nullptr;
|
||||
|
||||
@ -420,7 +420,7 @@ ServerFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD )
|
||||
if( !pFontInfo )
|
||||
return nullptr;
|
||||
|
||||
ServerFont* pNew = new ServerFont( rFSD, pFontInfo );
|
||||
FreetypeFont* pNew = new FreetypeFont( rFSD, pFontInfo );
|
||||
|
||||
return pNew;
|
||||
}
|
||||
@ -435,17 +435,17 @@ FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const FontAttributes&
|
||||
|
||||
LogicalFontInstance* FreetypeFontFace::CreateFontInstance( FontSelectPattern& rFSD ) const
|
||||
{
|
||||
ServerFontInstance* pEntry = new ServerFontInstance( rFSD );
|
||||
FreetypeFontInstance* pEntry = new FreetypeFontInstance( rFSD );
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
// ServerFont
|
||||
// FreetypeFont
|
||||
|
||||
ServerFont::ServerFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI )
|
||||
FreetypeFont::FreetypeFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI )
|
||||
: maGlyphList( 0),
|
||||
maFontSelData(rFSD),
|
||||
mnRefCount(1),
|
||||
mnBytesUsed( sizeof(ServerFont) ),
|
||||
mnBytesUsed( sizeof(FreetypeFont) ),
|
||||
mpPrevGCFont( nullptr ),
|
||||
mpNextGCFont( nullptr ),
|
||||
mnCos( 0x10000),
|
||||
@ -465,8 +465,8 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI )
|
||||
mpHbFont( nullptr )
|
||||
{
|
||||
// TODO: move update of mpFontInstance into FontEntry class when
|
||||
// it becomes responsible for the ServerFont instantiation
|
||||
static_cast<ServerFontInstance*>(rFSD.mpFontInstance)->SetServerFont( this );
|
||||
// it becomes responsible for the FreetypeFont instantiation
|
||||
static_cast<FreetypeFontInstance*>(rFSD.mpFontInstance)->SetFreetypeFont( this );
|
||||
|
||||
maFaceFT = pFI->GetFaceFT();
|
||||
|
||||
@ -538,7 +538,7 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI )
|
||||
mnLoadFlags |= FT_LOAD_NO_BITMAP;
|
||||
}
|
||||
|
||||
void ServerFont::SetFontOptions(const std::shared_ptr<FontConfigFontOptions>& xFontOptions)
|
||||
void FreetypeFont::SetFontOptions(const std::shared_ptr<FontConfigFontOptions>& xFontOptions)
|
||||
{
|
||||
mxFontOptions = xFontOptions;
|
||||
|
||||
@ -591,18 +591,18 @@ void ServerFont::SetFontOptions(const std::shared_ptr<FontConfigFontOptions>& xF
|
||||
mnLoadFlags |= FT_LOAD_NO_BITMAP;
|
||||
}
|
||||
|
||||
const std::shared_ptr<FontConfigFontOptions>& ServerFont::GetFontOptions() const
|
||||
const std::shared_ptr<FontConfigFontOptions>& FreetypeFont::GetFontOptions() const
|
||||
{
|
||||
return mxFontOptions;
|
||||
}
|
||||
|
||||
const OString& ServerFont::GetFontFileName() const
|
||||
const OString& FreetypeFont::GetFontFileName() const
|
||||
{
|
||||
return mpFontInfo->GetFontFileName();
|
||||
}
|
||||
|
||||
|
||||
ServerFont::~ServerFont()
|
||||
FreetypeFont::~FreetypeFont()
|
||||
{
|
||||
delete mpLayoutEngine;
|
||||
|
||||
@ -618,7 +618,7 @@ ServerFont::~ServerFont()
|
||||
}
|
||||
|
||||
|
||||
void ServerFont::GetFontMetric( ImplFontMetricDataRef& rxTo, long& rFactor ) const
|
||||
void FreetypeFont::GetFontMetric( ImplFontMetricDataRef& rxTo, long& rFactor ) const
|
||||
{
|
||||
rxTo->FontAttributes::operator =(mpFontInfo->GetFontAttributes());
|
||||
|
||||
@ -742,7 +742,7 @@ void ServerFont::GetFontMetric( ImplFontMetricDataRef& rxTo, long& rFactor ) con
|
||||
|
||||
}
|
||||
|
||||
static inline void SplitGlyphFlags( const ServerFont& rFont, sal_GlyphId& rGlyphId, int& nGlyphFlags )
|
||||
static inline void SplitGlyphFlags( const FreetypeFont& rFont, sal_GlyphId& rGlyphId, int& nGlyphFlags )
|
||||
{
|
||||
nGlyphFlags = rGlyphId & GF_FLAGMASK;
|
||||
rGlyphId &= GF_IDXMASK;
|
||||
@ -751,7 +751,7 @@ static inline void SplitGlyphFlags( const ServerFont& rFont, sal_GlyphId& rGlyph
|
||||
rGlyphId = rFont.GetRawGlyphIndex( rGlyphId );
|
||||
}
|
||||
|
||||
void ServerFont::ApplyGlyphTransform( int nGlyphFlags, FT_Glyph pGlyphFT ) const
|
||||
void FreetypeFont::ApplyGlyphTransform( int nGlyphFlags, FT_Glyph pGlyphFT ) const
|
||||
{
|
||||
int nAngle = GetFontSelData().mnOrientation;
|
||||
// shortcut most common case
|
||||
@ -820,7 +820,7 @@ void ServerFont::ApplyGlyphTransform( int nGlyphFlags, FT_Glyph pGlyphFT ) const
|
||||
}
|
||||
}
|
||||
|
||||
sal_GlyphId ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const
|
||||
sal_GlyphId FreetypeFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const
|
||||
{
|
||||
if( mpFontInfo->IsSymbolFont() )
|
||||
{
|
||||
@ -863,7 +863,7 @@ sal_GlyphId ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const
|
||||
return sal_GlyphId( nGlyphIndex);
|
||||
}
|
||||
|
||||
sal_GlyphId ServerFont::FixupGlyphIndex( sal_GlyphId aGlyphId, sal_UCS4 aChar ) const
|
||||
sal_GlyphId FreetypeFont::FixupGlyphIndex( sal_GlyphId aGlyphId, sal_UCS4 aChar ) const
|
||||
{
|
||||
int nGlyphFlags = GF_NONE;
|
||||
|
||||
@ -891,7 +891,7 @@ sal_GlyphId ServerFont::FixupGlyphIndex( sal_GlyphId aGlyphId, sal_UCS4 aChar )
|
||||
return aGlyphId;
|
||||
}
|
||||
|
||||
sal_GlyphId ServerFont::GetGlyphIndex( sal_UCS4 aChar ) const
|
||||
sal_GlyphId FreetypeFont::GetGlyphIndex( sal_UCS4 aChar ) const
|
||||
{
|
||||
sal_GlyphId aGlyphId = GetRawGlyphIndex( aChar );
|
||||
aGlyphId = FixupGlyphIndex( aGlyphId, aChar );
|
||||
@ -911,7 +911,7 @@ static int lcl_GetCharWidth( FT_FaceRec_* pFaceFT, double fStretch, int nGlyphFl
|
||||
return (nCharWidth + 32) >> 6;
|
||||
}
|
||||
|
||||
void ServerFont::InitGlyphData( sal_GlyphId aGlyphId, GlyphData& rGD ) const
|
||||
void FreetypeFont::InitGlyphData( sal_GlyphId aGlyphId, GlyphData& rGD ) const
|
||||
{
|
||||
FT_Activate_Size( maSizeFT );
|
||||
|
||||
@ -963,7 +963,7 @@ void ServerFont::InitGlyphData( sal_GlyphId aGlyphId, GlyphData& rGD ) const
|
||||
FT_Done_Glyph( pGlyphFT );
|
||||
}
|
||||
|
||||
bool ServerFont::GetAntialiasAdvice() const
|
||||
bool FreetypeFont::GetAntialiasAdvice() const
|
||||
{
|
||||
if( GetFontSelData().mbNonAntialiased || (mnPrioAntiAlias<=0) )
|
||||
return false;
|
||||
@ -974,7 +974,7 @@ bool ServerFont::GetAntialiasAdvice() const
|
||||
|
||||
// determine unicode ranges in font
|
||||
|
||||
const FontCharMapRef ServerFont::GetFontCharMap() const
|
||||
const FontCharMapRef FreetypeFont::GetFontCharMap() const
|
||||
{
|
||||
const FontCharMapRef xFCMap = mpFontInfo->GetFontCharMap();
|
||||
return xFCMap;
|
||||
@ -1053,7 +1053,7 @@ bool FreetypeFontInfo::GetFontCodeRanges( CmapResult& rResult ) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ServerFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
|
||||
bool FreetypeFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
@ -1232,7 +1232,7 @@ static int FT_cubic_to( const FT_Vector* p1, const FT_Vector* p2, const FT_Vecto
|
||||
|
||||
} // extern "C"
|
||||
|
||||
bool ServerFont::GetGlyphOutline( sal_GlyphId aGlyphId,
|
||||
bool FreetypeFont::GetGlyphOutline( sal_GlyphId aGlyphId,
|
||||
basegfx::B2DPolyPolygon& rB2DPolyPoly ) const
|
||||
{
|
||||
if( maSizeFT )
|
||||
@ -1309,7 +1309,7 @@ bool ServerFont::GetGlyphOutline( sal_GlyphId aGlyphId,
|
||||
return true;
|
||||
}
|
||||
|
||||
void ServerFont::ApplyGSUB( const FontSelectPattern& rFSD )
|
||||
void FreetypeFont::ApplyGSUB( const FontSelectPattern& rFSD )
|
||||
{
|
||||
#define MKTAG(s) ((((((s[0]<<8)+s[1])<<8)+s[2])<<8)+s[3])
|
||||
|
||||
@ -1535,13 +1535,13 @@ void ServerFont::ApplyGSUB( const FontSelectPattern& rFSD )
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned char* ServerFont::GetTable(const char* pName, sal_uLong* pLength)
|
||||
const unsigned char* FreetypeFont::GetTable(const char* pName, sal_uLong* pLength)
|
||||
{
|
||||
return mpFontInfo->GetTable( pName, pLength );
|
||||
}
|
||||
|
||||
#if ENABLE_GRAPHITE
|
||||
GraphiteFaceWrapper* ServerFont::GetGraphiteFace() const
|
||||
GraphiteFaceWrapper* FreetypeFont::GetGraphiteFace() const
|
||||
{
|
||||
return mpFontInfo->GetGraphiteFace();
|
||||
}
|
||||
|
@ -39,20 +39,20 @@
|
||||
#define HB_VERSION_ATLEAST(a,b,c) 0
|
||||
#endif
|
||||
|
||||
// layout implementation for ServerFont
|
||||
ServerFontLayout::ServerFontLayout( ServerFont& rFont )
|
||||
: mrServerFont( rFont )
|
||||
// layout implementation for FreetypeFont
|
||||
ServerFontLayout::ServerFontLayout( FreetypeFont& rFont )
|
||||
: mrFreetypeFont( rFont )
|
||||
{
|
||||
}
|
||||
|
||||
void ServerFontLayout::DrawText( SalGraphics& rSalGraphics ) const
|
||||
{
|
||||
rSalGraphics.DrawServerFontLayout( *this, mrServerFont );
|
||||
rSalGraphics.DrawServerFontLayout( *this, mrFreetypeFont );
|
||||
}
|
||||
|
||||
bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs )
|
||||
{
|
||||
return mrServerFont.GetLayoutEngine()->Layout(*this, rArgs);
|
||||
return mrFreetypeFont.GetLayoutEngine()->Layout(*this, rArgs);
|
||||
}
|
||||
|
||||
void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
|
||||
@ -68,10 +68,10 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
|
||||
// insert kashidas where requested by the formatting array
|
||||
if( (rArgs.mnFlags & SalLayoutFlags::KashidaJustification) && rArgs.mpDXArray )
|
||||
{
|
||||
int nKashidaIndex = mrServerFont.GetGlyphIndex( 0x0640 );
|
||||
int nKashidaIndex = mrFreetypeFont.GetGlyphIndex( 0x0640 );
|
||||
if( nKashidaIndex != 0 )
|
||||
{
|
||||
const GlyphMetric& rGM = mrServerFont.GetGlyphMetric( nKashidaIndex );
|
||||
const GlyphMetric& rGM = mrFreetypeFont.GetGlyphMetric( nKashidaIndex );
|
||||
KashidaJustify( nKashidaIndex, rGM.GetCharWidth() );
|
||||
// TODO: kashida-GSUB/GPOS
|
||||
}
|
||||
@ -105,7 +105,7 @@ void ServerFontLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos
|
||||
rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft);
|
||||
}
|
||||
|
||||
std::ostream &operator <<(std::ostream& s, ServerFont* pFont)
|
||||
std::ostream &operator <<(std::ostream& s, FreetypeFont* pFont)
|
||||
{
|
||||
#ifndef SAL_LOG_INFO
|
||||
(void) pFont;
|
||||
@ -129,7 +129,7 @@ static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
|
||||
pTagName[3] = (char)(nTableTag);
|
||||
pTagName[4] = 0;
|
||||
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pUserData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pUserData);
|
||||
|
||||
SAL_INFO("vcl.harfbuzz", "getFontTable(" << pFont << ", " << pTagName << ")");
|
||||
|
||||
@ -148,7 +148,7 @@ static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* pFontData,
|
||||
hb_codepoint_t* nGlyphIndex,
|
||||
void* /*pUserData*/)
|
||||
{
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pFontData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pFontData);
|
||||
*nGlyphIndex = pFont->GetRawGlyphIndex(ch, vs);
|
||||
|
||||
// tdf#89231 if the font is missing non-breaking space, then use a normal space
|
||||
@ -162,7 +162,7 @@ static hb_position_t getGlyphAdvanceH(hb_font_t* /*font*/, void* pFontData,
|
||||
hb_codepoint_t nGlyphIndex,
|
||||
void* /*pUserData*/)
|
||||
{
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pFontData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pFontData);
|
||||
const GlyphMetric& rGM = pFont->GetGlyphMetric(nGlyphIndex);
|
||||
return rGM.GetCharWidth() << 6;
|
||||
}
|
||||
@ -201,7 +201,7 @@ static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* pFontData,
|
||||
{
|
||||
// This callback is for old style 'kern' table, GPOS kerning is handled by HarfBuzz directly
|
||||
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pFontData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pFontData);
|
||||
FT_Face aFace = pFont->GetFtFace();
|
||||
|
||||
SAL_INFO("vcl.harfbuzz", "getGlyphKerningH(" << pFont << ", " << nGlyphIndex1 << ", " << nGlyphIndex2 << ")");
|
||||
@ -234,7 +234,7 @@ static hb_bool_t getGlyphExtents(hb_font_t* /*font*/, void* pFontData,
|
||||
hb_glyph_extents_t* pExtents,
|
||||
void* /*pUserData*/)
|
||||
{
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pFontData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pFontData);
|
||||
FT_Face aFace = pFont->GetFtFace();
|
||||
|
||||
SAL_INFO("vcl.harfbuzz", "getGlyphExtents(" << pFont << ", " << nGlyphIndex << ")");
|
||||
@ -258,7 +258,7 @@ static hb_bool_t getGlyphContourPoint(hb_font_t* /*font*/, void* pFontData,
|
||||
void* /*pUserData*/)
|
||||
{
|
||||
bool ret = false;
|
||||
ServerFont* pFont = static_cast<ServerFont*>(pFontData);
|
||||
FreetypeFont* pFont = static_cast<FreetypeFont*>(pFontData);
|
||||
FT_Face aFace = pFont->GetFtFace();
|
||||
|
||||
SAL_INFO("vcl.harfbuzz", "getGlyphContourPoint(" << pFont << ", " << nGlyphIndex << ", " << nPointIndex << ")");
|
||||
@ -326,21 +326,21 @@ private:
|
||||
int mnUnitsPerEM;
|
||||
|
||||
public:
|
||||
explicit HbLayoutEngine(ServerFont&);
|
||||
explicit HbLayoutEngine(FreetypeFont&);
|
||||
virtual ~HbLayoutEngine() override;
|
||||
|
||||
virtual bool Layout(ServerFontLayout&, ImplLayoutArgs&) override;
|
||||
};
|
||||
|
||||
HbLayoutEngine::HbLayoutEngine(ServerFont& rServerFont)
|
||||
HbLayoutEngine::HbLayoutEngine(FreetypeFont& rFreetypeFont)
|
||||
: maHbScript(HB_SCRIPT_INVALID),
|
||||
mpHbFace(nullptr),
|
||||
mnUnitsPerEM(0)
|
||||
{
|
||||
FT_Face aFtFace = rServerFont.GetFtFace();
|
||||
mnUnitsPerEM = rServerFont.GetEmUnits();
|
||||
FT_Face aFtFace = rFreetypeFont.GetFtFace();
|
||||
mnUnitsPerEM = rFreetypeFont.GetEmUnits();
|
||||
|
||||
mpHbFace = hb_face_create_for_tables(getFontTable, &rServerFont, nullptr);
|
||||
mpHbFace = hb_face_create_for_tables(getFontTable, &rFreetypeFont, nullptr);
|
||||
hb_face_set_index(mpHbFace, aFtFace->face_index);
|
||||
hb_face_set_upem(mpHbFace, mnUnitsPerEM);
|
||||
}
|
||||
@ -401,7 +401,7 @@ std::shared_ptr<vcl::TextLayoutCache> ServerFontLayout::CreateTextLayoutCache(
|
||||
|
||||
bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
|
||||
{
|
||||
ServerFont& rFont = rLayout.GetServerFont();
|
||||
FreetypeFont& rFont = rLayout.GetFreetypeFont();
|
||||
FT_Face aFtFace = rFont.GetFtFace();
|
||||
|
||||
SAL_INFO("vcl.harfbuzz", "layout(" << this << ",rArgs=" << rArgs << ")");
|
||||
@ -610,7 +610,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
|
||||
return true;
|
||||
}
|
||||
|
||||
ServerFontLayoutEngine* ServerFont::GetLayoutEngine()
|
||||
ServerFontLayoutEngine* FreetypeFont::GetLayoutEngine()
|
||||
{
|
||||
if (!mpLayoutEngine) {
|
||||
mpLayoutEngine = new HbLayoutEngine(*this);
|
||||
|
@ -59,10 +59,10 @@ void GlyphCache::InvalidateAllGlyphs()
|
||||
{
|
||||
for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it )
|
||||
{
|
||||
ServerFont* pServerFont = it->second;
|
||||
// free all pServerFont related data
|
||||
pServerFont->GarbageCollect( mnLruIndex+0x10000000 );
|
||||
delete pServerFont;
|
||||
FreetypeFont* pFreetypeFont = it->second;
|
||||
// free all pFreetypeFont related data
|
||||
pFreetypeFont->GarbageCollect( mnLruIndex+0x10000000 );
|
||||
delete pFreetypeFont;
|
||||
}
|
||||
|
||||
maFontList.clear();
|
||||
@ -166,7 +166,7 @@ void GlyphCache::ClearFontCache()
|
||||
mpFtManager->ClearFontList();
|
||||
}
|
||||
|
||||
ServerFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
|
||||
FreetypeFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
|
||||
{
|
||||
// a serverfont request has pFontData
|
||||
if( rFontSelData.mpFontData == nullptr )
|
||||
@ -182,14 +182,14 @@ ServerFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
|
||||
FontList::iterator it = maFontList.find( aFontSelData );
|
||||
if( it != maFontList.end() )
|
||||
{
|
||||
ServerFont* pFound = it->second;
|
||||
FreetypeFont* pFound = it->second;
|
||||
if( pFound )
|
||||
pFound->AddRef();
|
||||
return pFound;
|
||||
}
|
||||
|
||||
// font not cached yet => create new font item
|
||||
ServerFont* pNew = nullptr;
|
||||
FreetypeFont* pNew = nullptr;
|
||||
if( mpFtManager )
|
||||
pNew = mpFtManager->CreateFont( aFontSelData );
|
||||
|
||||
@ -217,11 +217,11 @@ ServerFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
|
||||
return pNew;
|
||||
}
|
||||
|
||||
void GlyphCache::UncacheFont( ServerFont& rServerFont )
|
||||
void GlyphCache::UncacheFont( FreetypeFont& rFreetypeFont )
|
||||
{
|
||||
if( (rServerFont.Release() <= 0) && (mnMaxSize <= mnBytesUsed) )
|
||||
if( (rFreetypeFont.Release() <= 0) && (mnMaxSize <= mnBytesUsed) )
|
||||
{
|
||||
mpCurrentGCFont = &rServerFont;
|
||||
mpCurrentGCFont = &rFreetypeFont;
|
||||
GarbageCollect();
|
||||
}
|
||||
}
|
||||
@ -241,50 +241,50 @@ void GlyphCache::GarbageCollect()
|
||||
return;
|
||||
|
||||
// prepare advance to next font for garbage collection
|
||||
ServerFont* const pServerFont = mpCurrentGCFont;
|
||||
mpCurrentGCFont = pServerFont->mpNextGCFont;
|
||||
FreetypeFont* const pFreetypeFont = mpCurrentGCFont;
|
||||
mpCurrentGCFont = pFreetypeFont->mpNextGCFont;
|
||||
|
||||
if( (pServerFont == mpCurrentGCFont) // no other fonts
|
||||
|| (pServerFont->GetRefCount() > 0) ) // font still used
|
||||
if( (pFreetypeFont == mpCurrentGCFont) // no other fonts
|
||||
|| (pFreetypeFont->GetRefCount() > 0) ) // font still used
|
||||
{
|
||||
// try to garbage collect at least a few bytes
|
||||
pServerFont->GarbageCollect( mnLruIndex - mnGlyphCount/2 );
|
||||
pFreetypeFont->GarbageCollect( mnLruIndex - mnGlyphCount/2 );
|
||||
}
|
||||
else // current GC font is unreferenced
|
||||
{
|
||||
SAL_WARN_IF( (pServerFont->GetRefCount() != 0), "vcl",
|
||||
SAL_WARN_IF( (pFreetypeFont->GetRefCount() != 0), "vcl",
|
||||
"GlyphCache::GC detected RefCount underflow" );
|
||||
|
||||
// free all pServerFont related data
|
||||
pServerFont->GarbageCollect( mnLruIndex+0x10000000 );
|
||||
if( pServerFont == mpCurrentGCFont )
|
||||
// free all pFreetypeFont related data
|
||||
pFreetypeFont->GarbageCollect( mnLruIndex+0x10000000 );
|
||||
if( pFreetypeFont == mpCurrentGCFont )
|
||||
mpCurrentGCFont = nullptr;
|
||||
const FontSelectPattern& rIFSD = pServerFont->GetFontSelData();
|
||||
const FontSelectPattern& rIFSD = pFreetypeFont->GetFontSelData();
|
||||
maFontList.erase( rIFSD );
|
||||
mnBytesUsed -= pServerFont->GetByteCount();
|
||||
mnBytesUsed -= pFreetypeFont->GetByteCount();
|
||||
|
||||
// remove font from list of garbage collected fonts
|
||||
if( pServerFont->mpPrevGCFont )
|
||||
pServerFont->mpPrevGCFont->mpNextGCFont = pServerFont->mpNextGCFont;
|
||||
if( pServerFont->mpNextGCFont )
|
||||
pServerFont->mpNextGCFont->mpPrevGCFont = pServerFont->mpPrevGCFont;
|
||||
if( pServerFont == mpCurrentGCFont )
|
||||
if( pFreetypeFont->mpPrevGCFont )
|
||||
pFreetypeFont->mpPrevGCFont->mpNextGCFont = pFreetypeFont->mpNextGCFont;
|
||||
if( pFreetypeFont->mpNextGCFont )
|
||||
pFreetypeFont->mpNextGCFont->mpPrevGCFont = pFreetypeFont->mpPrevGCFont;
|
||||
if( pFreetypeFont == mpCurrentGCFont )
|
||||
mpCurrentGCFont = nullptr;
|
||||
|
||||
delete pServerFont;
|
||||
delete pFreetypeFont;
|
||||
}
|
||||
}
|
||||
|
||||
inline void GlyphCache::UsingGlyph( ServerFont&, GlyphData& rGlyphData )
|
||||
inline void GlyphCache::UsingGlyph( FreetypeFont&, GlyphData& rGlyphData )
|
||||
{
|
||||
rGlyphData.SetLruValue( mnLruIndex++ );
|
||||
}
|
||||
|
||||
inline void GlyphCache::AddedGlyph( ServerFont& rServerFont, GlyphData& rGlyphData )
|
||||
inline void GlyphCache::AddedGlyph( FreetypeFont& rFreetypeFont, GlyphData& rGlyphData )
|
||||
{
|
||||
++mnGlyphCount;
|
||||
mnBytesUsed += sizeof( rGlyphData );
|
||||
UsingGlyph( rServerFont, rGlyphData );
|
||||
UsingGlyph( rFreetypeFont, rGlyphData );
|
||||
if( mnBytesUsed > mnMaxSize )
|
||||
GarbageCollect();
|
||||
}
|
||||
@ -295,24 +295,24 @@ inline void GlyphCache::RemovingGlyph()
|
||||
--mnGlyphCount;
|
||||
}
|
||||
|
||||
void ServerFont::ReleaseFromGarbageCollect()
|
||||
void FreetypeFont::ReleaseFromGarbageCollect()
|
||||
{
|
||||
// remove from GC list
|
||||
ServerFont* pPrev = mpPrevGCFont;
|
||||
ServerFont* pNext = mpNextGCFont;
|
||||
FreetypeFont* pPrev = mpPrevGCFont;
|
||||
FreetypeFont* pNext = mpNextGCFont;
|
||||
if( pPrev ) pPrev->mpNextGCFont = pNext;
|
||||
if( pNext ) pNext->mpPrevGCFont = pPrev;
|
||||
mpPrevGCFont = nullptr;
|
||||
mpNextGCFont = nullptr;
|
||||
}
|
||||
|
||||
long ServerFont::Release() const
|
||||
long FreetypeFont::Release() const
|
||||
{
|
||||
SAL_WARN_IF( mnRefCount <= 0, "vcl", "ServerFont: RefCount underflow" );
|
||||
SAL_WARN_IF( mnRefCount <= 0, "vcl", "FreetypeFont: RefCount underflow" );
|
||||
return --mnRefCount;
|
||||
}
|
||||
|
||||
GlyphData& ServerFont::GetGlyphData( sal_GlyphId aGlyphId )
|
||||
GlyphData& FreetypeFont::GetGlyphData( sal_GlyphId aGlyphId )
|
||||
{
|
||||
// usually the GlyphData is cached
|
||||
GlyphList::iterator it = maGlyphList.find( aGlyphId );
|
||||
@ -330,7 +330,7 @@ GlyphData& ServerFont::GetGlyphData( sal_GlyphId aGlyphId )
|
||||
return rGlyphData;
|
||||
}
|
||||
|
||||
void ServerFont::GarbageCollect( long nMinLruIndex )
|
||||
void FreetypeFont::GarbageCollect( long nMinLruIndex )
|
||||
{
|
||||
GlyphList::iterator it = maGlyphList.begin();
|
||||
while( it != maGlyphList.end() )
|
||||
@ -348,27 +348,27 @@ void ServerFont::GarbageCollect( long nMinLruIndex )
|
||||
}
|
||||
}
|
||||
|
||||
ServerFontInstance::ServerFontInstance( FontSelectPattern& rFSD )
|
||||
FreetypeFontInstance::FreetypeFontInstance( FontSelectPattern& rFSD )
|
||||
: LogicalFontInstance( rFSD )
|
||||
, mpServerFont( nullptr )
|
||||
, mpFreetypeFont( nullptr )
|
||||
, mbGotFontOptions( false )
|
||||
{}
|
||||
|
||||
void ServerFontInstance::SetServerFont(ServerFont* p)
|
||||
void FreetypeFontInstance::SetFreetypeFont(FreetypeFont* p)
|
||||
{
|
||||
if (p == mpServerFont)
|
||||
if (p == mpFreetypeFont)
|
||||
return;
|
||||
if (mpServerFont)
|
||||
mpServerFont->Release();
|
||||
mpServerFont = p;
|
||||
if (mpServerFont)
|
||||
mpServerFont->AddRef();
|
||||
if (mpFreetypeFont)
|
||||
mpFreetypeFont->Release();
|
||||
mpFreetypeFont = p;
|
||||
if (mpFreetypeFont)
|
||||
mpFreetypeFont->AddRef();
|
||||
}
|
||||
|
||||
ServerFontInstance::~ServerFontInstance()
|
||||
FreetypeFontInstance::~FreetypeFontInstance()
|
||||
{
|
||||
// TODO: remove the ServerFont here instead of in the GlyphCache
|
||||
if (mpServerFont)
|
||||
mpServerFont->Release();
|
||||
// TODO: remove the FreetypeFont here instead of in the GlyphCache
|
||||
if (mpFreetypeFont)
|
||||
mpFreetypeFont->Release();
|
||||
}
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -30,70 +30,70 @@
|
||||
|
||||
float freetypeServerFontAdvance(const void* appFontHandle, gr_uint16 glyphId)
|
||||
{
|
||||
ServerFont * pServerFont =
|
||||
const_cast<ServerFont*>
|
||||
(static_cast<const ServerFont*>(appFontHandle));
|
||||
if (pServerFont)
|
||||
FreetypeFont * pFreetypeFont =
|
||||
const_cast<FreetypeFont*>
|
||||
(static_cast<const FreetypeFont*>(appFontHandle));
|
||||
if (pFreetypeFont)
|
||||
{
|
||||
return static_cast<float>(pServerFont->GetGlyphMetric(glyphId).GetCharWidth());
|
||||
return static_cast<float>(pFreetypeFont->GetGlyphMetric(glyphId).GetCharWidth());
|
||||
}
|
||||
return .0f;
|
||||
}
|
||||
|
||||
// An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used.
|
||||
|
||||
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont& rServerFont) throw()
|
||||
: ServerFontLayout(rServerFont),
|
||||
maImpl(rServerFont.GetGraphiteFace()->face(), rServerFont)
|
||||
GraphiteServerFontLayout::GraphiteServerFontLayout(FreetypeFont& rFreetypeFont) throw()
|
||||
: ServerFontLayout(rFreetypeFont),
|
||||
maImpl(rFreetypeFont.GetGraphiteFace()->face(), rFreetypeFont)
|
||||
, mpFeatures(nullptr)
|
||||
{
|
||||
gr_font * pFont = rServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
|
||||
gr_font * pFont = rFreetypeFont.GetGraphiteFace()->font(rFreetypeFont.GetFontSelData().mnHeight, rFreetypeFont.NeedsArtificialBold(), rFreetypeFont.NeedsArtificialItalic());
|
||||
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),
|
||||
&rServerFont,
|
||||
static_cast<float>(rFreetypeFont.GetFontSelData().mnHeight),
|
||||
&rFreetypeFont,
|
||||
freetypeServerFontAdvance,
|
||||
rServerFont.GetGraphiteFace()->face());
|
||||
rServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
|
||||
rFreetypeFont.GetGraphiteFace()->face());
|
||||
rFreetypeFont.GetGraphiteFace()->addFont(rFreetypeFont.GetFontSelData().mnHeight, pFont, rFreetypeFont.NeedsArtificialBold(), rFreetypeFont.NeedsArtificialItalic());
|
||||
}
|
||||
maImpl.SetFont(pFont);
|
||||
OString aLang("");
|
||||
if (rServerFont.GetFontSelData().meLanguage != LANGUAGE_DONTKNOW)
|
||||
if (rFreetypeFont.GetFontSelData().meLanguage != LANGUAGE_DONTKNOW)
|
||||
{
|
||||
aLang = OUStringToOString( LanguageTag( rServerFont.GetFontSelData().meLanguage ).getBcp47(),
|
||||
aLang = OUStringToOString( LanguageTag( rFreetypeFont.GetFontSelData().meLanguage ).getBcp47(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
}
|
||||
OString name = OUStringToOString(
|
||||
rServerFont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 );
|
||||
rFreetypeFont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 );
|
||||
#ifdef DEBUG
|
||||
printf("GraphiteServerFontLayout %lx %s size %d %f\n", (long unsigned int)this, name.getStr(),
|
||||
rServerFont.GetFtFace()->size->metrics.x_ppem,
|
||||
rServerFont.GetFontSelData().mfExactHeight);
|
||||
rFreetypeFont.GetFtFace()->size->metrics.x_ppem,
|
||||
rFreetypeFont.GetFontSelData().mfExactHeight);
|
||||
#endif
|
||||
sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1;
|
||||
if (nFeat > 0)
|
||||
{
|
||||
OString aFeat = name.copy(nFeat, name.getLength() - nFeat);
|
||||
mpFeatures = new grutils::GrFeatureParser(
|
||||
rServerFont.GetGraphiteFace()->face(), aFeat, aLang);
|
||||
rFreetypeFont.GetGraphiteFace()->face(), aFeat, aLang);
|
||||
#ifdef DEBUG
|
||||
if (mpFeatures)
|
||||
printf("GraphiteServerFontLayout %s/%s/%s %x language\n",
|
||||
OUStringToOString( rServerFont.GetFontSelData().GetFamilyName(),
|
||||
OUStringToOString( rFreetypeFont.GetFontSelData().GetFamilyName(),
|
||||
RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
OUStringToOString( rServerFont.GetFontSelData().maTargetName,
|
||||
OUStringToOString( rFreetypeFont.GetFontSelData().maTargetName,
|
||||
RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
OUStringToOString( rServerFont.GetFontSelData().maSearchName,
|
||||
OUStringToOString( rFreetypeFont.GetFontSelData().maSearchName,
|
||||
RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
rServerFont.GetFontSelData().meLanguage);
|
||||
rFreetypeFont.GetFontSelData().meLanguage);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
mpFeatures = new grutils::GrFeatureParser(
|
||||
rServerFont.GetGraphiteFace()->face(), aLang);
|
||||
rFreetypeFont.GetGraphiteFace()->face(), aLang);
|
||||
}
|
||||
maImpl.SetFeatures(mpFeatures);
|
||||
}
|
||||
@ -104,9 +104,9 @@ GraphiteServerFontLayout::~GraphiteServerFontLayout() throw()
|
||||
mpFeatures = nullptr;
|
||||
}
|
||||
|
||||
bool GraphiteServerFontLayout::IsGraphiteEnabledFont(ServerFont& rServerFont)
|
||||
bool GraphiteServerFontLayout::IsGraphiteEnabledFont(FreetypeFont& rFreetypeFont)
|
||||
{
|
||||
if (rServerFont.GetGraphiteFace())
|
||||
if (rFreetypeFont.GetGraphiteFace())
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("IsGraphiteEnabledFont\n");
|
||||
@ -118,10 +118,10 @@ bool GraphiteServerFontLayout::IsGraphiteEnabledFont(ServerFont& rServerFont)
|
||||
|
||||
sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width)
|
||||
{
|
||||
int nKashidaIndex = mrServerFont.GetGlyphIndex( 0x0640 );
|
||||
int nKashidaIndex = mrFreetypeFont.GetGlyphIndex( 0x0640 );
|
||||
if( nKashidaIndex != 0 )
|
||||
{
|
||||
const GlyphMetric& rGM = mrServerFont.GetGlyphMetric( nKashidaIndex );
|
||||
const GlyphMetric& rGM = mrFreetypeFont.GetGlyphMetric( nKashidaIndex );
|
||||
width = rGM.GetCharWidth();
|
||||
}
|
||||
else
|
||||
|
@ -262,7 +262,7 @@ GenPspGraphics::GenPspGraphics()
|
||||
m_bFontVertical( false ),
|
||||
m_pInfoPrinter( nullptr )
|
||||
{
|
||||
for(ServerFont* & rp : m_pServerFont)
|
||||
for(FreetypeFont* & rp : m_pFreetypeFont)
|
||||
rp = nullptr;
|
||||
}
|
||||
|
||||
@ -562,7 +562,7 @@ ImplPspFontData::ImplPspFontData( const psp::FastPrintFontInfo& rInfo )
|
||||
|
||||
LogicalFontInstance* ImplPspFontData::CreateFontInstance( FontSelectPattern& rFSD ) const
|
||||
{
|
||||
ServerFontInstance* pEntry = new ServerFontInstance( rFSD );
|
||||
FreetypeFontInstance* pEntry = new FreetypeFontInstance( rFSD );
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ bool PspFontLayout::LayoutText( ImplLayoutArgs& rArgs )
|
||||
class PspServerFontLayout : public ServerFontLayout
|
||||
{
|
||||
public:
|
||||
PspServerFontLayout( psp::PrinterGfx&, ServerFont& rFont, const ImplLayoutArgs& rArgs );
|
||||
PspServerFontLayout( psp::PrinterGfx&, FreetypeFont& rFont, const ImplLayoutArgs& rArgs );
|
||||
|
||||
virtual void InitFont() const override;
|
||||
const sal_Unicode* getTextPtr() const { return maText.getStr() - mnMinCharPos; }
|
||||
@ -674,7 +674,7 @@ private:
|
||||
int mnMinCharPos;
|
||||
};
|
||||
|
||||
PspServerFontLayout::PspServerFontLayout( ::psp::PrinterGfx& rGfx, ServerFont& rFont, const ImplLayoutArgs& rArgs )
|
||||
PspServerFontLayout::PspServerFontLayout( ::psp::PrinterGfx& rGfx, FreetypeFont& rFont, const ImplLayoutArgs& rArgs )
|
||||
: ServerFontLayout( rFont ),
|
||||
mrPrinterGfx( rGfx )
|
||||
{
|
||||
@ -761,7 +761,7 @@ void PspFontLayout::DrawText( SalGraphics& ) const
|
||||
DrawPrinterLayout( *this, mrPrinterGfx, false );
|
||||
}
|
||||
|
||||
void GenPspGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, const ServerFont& /*unused*/ )
|
||||
void GenPspGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, const FreetypeFont& /*unused*/ )
|
||||
{
|
||||
// print complex text
|
||||
DrawPrinterLayout( rLayout, *m_pPrinterGfx, true );
|
||||
@ -769,18 +769,18 @@ void GenPspGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, cons
|
||||
|
||||
const FontCharMapRef GenPspGraphics::GetFontCharMap() const
|
||||
{
|
||||
if( !m_pServerFont[0] )
|
||||
if( !m_pFreetypeFont[0] )
|
||||
return nullptr;
|
||||
|
||||
const FontCharMapRef xFCMap = m_pServerFont[0]->GetFontCharMap();
|
||||
const FontCharMapRef xFCMap = m_pFreetypeFont[0]->GetFontCharMap();
|
||||
return xFCMap;
|
||||
}
|
||||
|
||||
bool GenPspGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
|
||||
{
|
||||
if (!m_pServerFont[0])
|
||||
if (!m_pFreetypeFont[0])
|
||||
return false;
|
||||
return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities);
|
||||
return m_pFreetypeFont[0]->GetFontCapabilities(rFontCapabilities);
|
||||
}
|
||||
|
||||
void GenPspGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
|
||||
@ -788,11 +788,11 @@ void GenPspGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
|
||||
// release all fonts that are to be overridden
|
||||
for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
|
||||
{
|
||||
if( m_pServerFont[i] != nullptr )
|
||||
if( m_pFreetypeFont[i] != nullptr )
|
||||
{
|
||||
// old server side font is no longer referenced
|
||||
GlyphCache::GetInstance().UncacheFont( *m_pServerFont[i] );
|
||||
m_pServerFont[i] = nullptr;
|
||||
GlyphCache::GetInstance().UncacheFont( *m_pFreetypeFont[i] );
|
||||
m_pFreetypeFont[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -823,13 +823,13 @@ void GenPspGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
|
||||
if( pEntry->mpFontData )
|
||||
{
|
||||
// requesting a font provided by builtin rasterizer
|
||||
ServerFont* pServerFont = GlyphCache::GetInstance().CacheFont( *pEntry );
|
||||
if( pServerFont != nullptr )
|
||||
FreetypeFont* pFreetypeFont = GlyphCache::GetInstance().CacheFont( *pEntry );
|
||||
if( pFreetypeFont != nullptr )
|
||||
{
|
||||
if( pServerFont->TestFont() )
|
||||
m_pServerFont[ nFallbackLevel ] = pServerFont;
|
||||
if( pFreetypeFont->TestFont() )
|
||||
m_pFreetypeFont[ nFallbackLevel ] = pFreetypeFont;
|
||||
else
|
||||
GlyphCache::GetInstance().UncacheFont( *pServerFont );
|
||||
GlyphCache::GetInstance().UncacheFont( *pFreetypeFont );
|
||||
}
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@ bool GenPspGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
|
||||
if( nLevel >= MAX_FALLBACK )
|
||||
return false;
|
||||
|
||||
ServerFont* pSF = m_pServerFont[ nLevel ];
|
||||
FreetypeFont* pSF = m_pFreetypeFont[ nLevel ];
|
||||
if( !pSF )
|
||||
return false;
|
||||
|
||||
@ -967,7 +967,7 @@ bool GenPspGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
|
||||
if( nLevel >= MAX_FALLBACK )
|
||||
return false;
|
||||
|
||||
ServerFont* pSF = m_pServerFont[ nLevel ];
|
||||
FreetypeFont* pSF = m_pFreetypeFont[ nLevel ];
|
||||
if( !pSF )
|
||||
return false;
|
||||
|
||||
@ -989,18 +989,18 @@ SalLayout* GenPspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
|
||||
|
||||
GenericSalLayout* pLayout = nullptr;
|
||||
|
||||
if( m_pServerFont[ nFallbackLevel ]
|
||||
if( m_pFreetypeFont[ nFallbackLevel ]
|
||||
&& !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) )
|
||||
{
|
||||
#if ENABLE_GRAPHITE
|
||||
// Is this a Graphite font?
|
||||
if (GraphiteServerFontLayout::IsGraphiteEnabledFont(*m_pServerFont[nFallbackLevel]))
|
||||
if (GraphiteServerFontLayout::IsGraphiteEnabledFont(*m_pFreetypeFont[nFallbackLevel]))
|
||||
{
|
||||
pLayout = new GraphiteServerFontLayout(*m_pServerFont[nFallbackLevel]);
|
||||
pLayout = new GraphiteServerFontLayout(*m_pFreetypeFont[nFallbackLevel]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pServerFont[nFallbackLevel], rArgs );
|
||||
pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel], rArgs );
|
||||
}
|
||||
else
|
||||
pLayout = new PspFontLayout( *m_pPrinterGfx );
|
||||
|
Loading…
x
Reference in New Issue
Block a user