summaryrefslogtreecommitdiff
path: root/vcl/coretext
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-06-14 11:10:32 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-06-16 15:30:01 +0000
commit3d12036000f4e13127affc0cb764fc65cf89af44 (patch)
treec52bb99e41e41e274c741ac6bbd5a7279494fe62 /vcl/coretext
parent7441d4bbdbbcb87193c32510f3577a0e531467e5 (diff)
Get rid of SalLayout::GetFallbackFontData()
This is only used in conjunction with SalLayout::GetNextGlyphs() in vcl/source/gdi/pdfwriter_impl.cxx to retrieve the fallback font, if any, used to layout the given glyph, but it is a very convoluted way to do a straight forward thing, and hard to adapt for new SalLayout implementations. So now I just pass a fallback fonts array, when requested, in GetNextGlyphs() itself. Change-Id: I24e7931f64867a4fb4e7b728c65faa6198e24aba Reviewed-on: https://gerrit.libreoffice.org/4285 Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Tested-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/coretext')
-rw-r--r--vcl/coretext/ctlayout.cxx32
1 files changed, 8 insertions, 24 deletions
diff --git a/vcl/coretext/ctlayout.cxx b/vcl/coretext/ctlayout.cxx
index a5915d9e663e..89ecf0933fb1 100644
--- a/vcl/coretext/ctlayout.cxx
+++ b/vcl/coretext/ctlayout.cxx
@@ -35,7 +35,8 @@ public:
virtual void DrawText( SalGraphics& ) const;
virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
- sal_Int32* pGlyphAdvances, int* pCharIndexes ) const;
+ sal_Int32* pGlyphAdvances, int* pCharIndexes,
+ const PhysicalFontFace** pFallbackFonts ) const;
virtual long GetTextWidth() const;
virtual long FillDXArray( sal_Int32* pDXArray ) const;
@@ -44,8 +45,6 @@ public:
virtual bool GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const;
virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const;
- const PhysicalFontFace* GetFallbackFontData( sal_GlyphId ) const;
-
virtual void InitFont( void) const;
virtual void MoveGlyph( int nStart, long nNewXPos );
virtual void DropGlyph( int nStart );
@@ -224,7 +223,8 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const
// -----------------------------------------------------------------------
int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int& nStart,
- sal_Int32* pGlyphAdvances, int* pCharIndexes ) const
+ sal_Int32* pGlyphAdvances, int* pCharIndexes,
+ const PhysicalFontFace** pFallbackFonts ) const
{
if( !mpCTLine )
return 0;
@@ -293,6 +293,8 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int&
}
}
+ const PhysicalFontFace* pFallbackFont = NULL;
+
// get the details for each interesting glyph
// TODO: handle nLen>1
for(; (--nLen >= 0) && (nSubIndex < nGlyphsInRun); ++nSubIndex, ++nStart )
@@ -303,6 +305,8 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int&
*(pGlyphAdvances++) = pCGGlyphAdvs[ nSubIndex ].width;
if( pCharIndexes )
*(pCharIndexes++) = pCGGlyphStrIdx[ nSubIndex] + mnMinCharPos;
+ if( pFallbackFonts )
+ *(pFallbackFonts++) = pFallbackFont;
if( !nCount++ ) {
const CGPoint& rCurPos = pCGGlyphPos[ nSubIndex ];
rPos = GetDrawPosition( Point( mfFontScale * rCurPos.x, mfFontScale * rCurPos.y) );
@@ -448,26 +452,6 @@ void CTLayout::MoveGlyph( int /*nStart*/, long /*nNewXPos*/ ) {}
void CTLayout::DropGlyph( int /*nStart*/ ) {}
void CTLayout::Simplify( bool /*bIsBase*/ ) {}
-// get the PhysicalFontFace for a glyph fallback font
-// for a glyphid that was returned by CTLayout::GetNextGlyphs()
-const PhysicalFontFace* CTLayout::GetFallbackFontData( sal_GlyphId /*nGlyphId*/ ) const
-{
-#if 0
- // check if any fallback fonts were needed
- if( !mpFallbackInfo )
- return NULL;
- // check if the current glyph needs a fallback font
- int nFallbackLevel = (nGlyphId & GF_FONTMASK) >> GF_FONTSHIFT;
- if( !nFallbackLevel )
- return NULL;
- pFallbackFont = mpFallbackInfo->GetFallbackFontData( nFallbackLevel );
-#else
- // let CoreText's font cascading handle glyph fallback
- const PhysicalFontFace* pFallbackFont = NULL;
-#endif
- return pFallbackFont;
-}
-
// =======================================================================
SalLayout* CTTextStyle::GetTextLayout( void ) const