Kaydet (Commit) 1ee8a779 authored tarafından Caolán McNamara's avatar Caolán McNamara

now cairo is the only way to render text under X

üst 8e64e571
......@@ -194,7 +194,7 @@ public:
const ::rtl::OString* GetFontFileName() const;
int GetFontFaceNumber() const;
bool TestFont() const;
void* GetFtFace() const;
FT_Face GetFtFace() const;
int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
void SetFontOptions( boost::shared_ptr<ImplFontOptions> );
boost::shared_ptr<ImplFontOptions> GetFontOptions() const;
......
......@@ -64,18 +64,20 @@ namespace basegfx {
// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
typedef struct FT_FaceRec_* FT_Face;
class CairoFontsCache
{
public:
struct CacheId
{
const void *mpFace;
FT_Face maFace;
const void *mpOptions;
bool mbEmbolden;
bool mbVerticalMetrics;
bool operator ==(const CacheId& rOther) const
{
return mpFace == rOther.mpFace &&
return maFace == rOther.maFace &&
mpOptions == rOther.mpOptions &&
mbEmbolden == rOther.mbEmbolden &&
mbVerticalMetrics == rOther.mbVerticalMetrics;
......
......@@ -235,14 +235,6 @@ void ImplServerFontEntry::HandleFontOptions( void )
//--------------------------------------------------------------------------
namespace
{
bool isCairoRenderable(const ServerFont& rFont)
{
return rFont.GetFtFace();
}
} //namespace
CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts;
int CairoFontsCache::mnRefCount = 0;
......@@ -370,9 +362,9 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
ServerFont& rFont = rLayout.GetServerFont();
void* pFace = rFont.GetFtFace();
FT_Face aFace = rFont.GetFtFace();
CairoFontsCache::CacheId aId;
aId.mpFace = pFace;
aId.maFace = aFace;
aId.mpOptions = rFont.GetFontOptions().get();
aId.mbEmbolden = rFont.NeedsArtificialBold();
......@@ -398,11 +390,11 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
if (!font_face)
{
const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden, aId.mbVerticalMetrics) : NULL;
void *pPattern = pOptions ? pOptions->GetPattern(aFace, aId.mbEmbolden, aId.mbVerticalMetrics) : NULL;
if (pPattern)
font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern));
if (!font_face)
font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags());
font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(aFace), rFont.GetLoadFlags());
m_aCairoFontsCache.CacheFont(font_face, aId);
}
cairo_set_font_face(cr, font_face);
......@@ -427,7 +419,6 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
cairo_matrix_init_identity(&em_square);
cairo_get_matrix(cr, &em_square);
FT_Face aFace = reinterpret_cast<FT_Face>(pFace);
cairo_matrix_scale(&em_square, aFace->units_per_EM,
aFace->units_per_EM);
cairo_set_matrix(cr, &em_square);
......@@ -832,20 +823,7 @@ void X11SalGraphics::DrawServerSimpleFontString( const ServerFontLayout& rSalLay
void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
{
// draw complex text
ServerFont& rFont = rLayout.GetServerFont();
if( isCairoRenderable(rFont) )
DrawCairoAAFontString( rLayout );
else
{
X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
if( rGlyphPeer.GetGlyphSet( rFont, m_nScreen ) )
DrawServerAAFontString( rLayout );
else if( !rGlyphPeer.ForcedAntialiasing( rFont, m_nScreen ) )
DrawServerSimpleFontString( rLayout );
else
DrawServerAAForcedString( rLayout );
}
DrawCairoAAFontString( rLayout );
}
//--------------------------------------------------------------------------
......
......@@ -577,7 +577,7 @@ FreetypeManager::FreetypeManager()
// -----------------------------------------------------------------------
void* ServerFont::GetFtFace() const
FT_Face ServerFont::GetFtFace() const
{
if( maSizeFT )
pFTActivateSize( maSizeFT );
......
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