From a16aacd6474f02307341646ec08f9e1608a8615d Mon Sep 17 00:00:00 2001 From: Herbert Dürr Date: Mon, 16 Dec 2013 16:07:41 +0000 Subject: Resolves: #i123840# add and use the sal_GlyphId type Using the central definition adds consistency and cleans up many ad hoc declarations. The type sal_GlyphId will become a class in the future so that its bitfield operations etc. can then be isolated into nice methods. (cherry picked from commit c0a84ad10964fb7a65b6239cbe1cef8698b5d17b) Conflicts: vcl/aqua/source/gdi/salatslayout.cxx vcl/aqua/source/gdi/salgdi.cxx vcl/generic/glyphs/gcach_ftyp.cxx vcl/generic/print/genpspgraphics.cxx vcl/generic/print/glyphset.cxx vcl/generic/print/glyphset.hxx vcl/headless/svptext.cxx vcl/inc/generic/genpspgraphics.h vcl/inc/generic/glyphcache.hxx vcl/inc/os2/salgdi.h vcl/inc/quartz/salgdi.h vcl/inc/salgdi.hxx vcl/inc/sallayout.hxx vcl/inc/unx/salgdi.h vcl/inc/vcl/fontmanager.hxx vcl/inc/win/salgdi.h vcl/os2/source/gdi/os2layout.cxx vcl/os2/source/gdi/salgdi3.cxx vcl/source/gdi/pdfwriter_impl.cxx vcl/source/gdi/sallayout.cxx vcl/source/glyphs/gcach_ftyp.hxx vcl/source/glyphs/gcach_layout.cxx vcl/source/glyphs/glyphcache.cxx vcl/source/glyphs/graphite_layout.cxx vcl/unx/generic/fontmanager/fontmanager.cxx vcl/unx/generic/gdi/gcach_xpeer.cxx vcl/unx/generic/gdi/gcach_xpeer.hxx vcl/unx/generic/gdi/salgdi3.cxx vcl/unx/generic/gdi/xrender_peer.hxx vcl/unx/headless/svpgdi.hxx vcl/unx/headless/svppspgraphics.cxx vcl/unx/headless/svppspgraphics.hxx vcl/win/source/gdi/salgdi3.cxx vcl/win/source/gdi/winlayout.cxx Change-Id: Ic629131950360e2df4c15db30d6a5362193c6330 --- vcl/generic/glyphs/gcach_ftyp.cxx | 62 +++++++++++++++++++-------------------- vcl/generic/glyphs/glyphcache.cxx | 8 ++--- 2 files changed, 35 insertions(+), 35 deletions(-) (limited to 'vcl/generic/glyphs') diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 62d114e3875b..d6017db55f7a 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -810,13 +810,13 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const // ----------------------------------------------------------------------- -static inline void SplitGlyphFlags( const ServerFont& rFont, int& nGlyphIndex, int& nGlyphFlags ) +static inline void SplitGlyphFlags( const ServerFont& rFont, sal_GlyphId& rGlyphId, int& nGlyphFlags ) { - nGlyphFlags = nGlyphIndex & GF_FLAGMASK; - nGlyphIndex &= GF_IDXMASK; + nGlyphFlags = rGlyphId & GF_FLAGMASK; + rGlyphId &= GF_IDXMASK; - if( nGlyphIndex & GF_ISCHAR ) - nGlyphIndex = rFont.GetRawGlyphIndex( nGlyphIndex ); + if( rGlyphId & GF_ISCHAR ) + rGlyphId = rFont.GetRawGlyphIndex( rGlyphId ); } // ----------------------------------------------------------------------- @@ -896,7 +896,7 @@ int ServerFont::ApplyGlyphTransform( int nGlyphFlags, // ----------------------------------------------------------------------- -int ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const +sal_GlyphId ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const { if( mpFontInfo->IsSymbolFont() ) { @@ -936,12 +936,12 @@ int ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const } } - return nGlyphIndex; + return sal_GlyphId( nGlyphIndex); } // ----------------------------------------------------------------------- -int ServerFont::FixupGlyphIndex( int nGlyphIndex, sal_UCS4 aChar ) const +sal_GlyphId ServerFont::FixupGlyphIndex( sal_GlyphId aGlyphId, sal_UCS4 aChar ) const { int nGlyphFlags = GF_NONE; @@ -950,39 +950,39 @@ int ServerFont::FixupGlyphIndex( int nGlyphIndex, sal_UCS4 aChar ) const if( GetFontSelData().mbVertical ) { // TODO: rethink when GSUB is used for non-vertical case - GlyphSubstitution::const_iterator it = maGlyphSubstitution.find( nGlyphIndex ); + GlyphSubstitution::const_iterator it = maGlyphSubstitution.find( aGlyphId ); if( it == maGlyphSubstitution.end() ) { - int nTemp = GetVerticalChar( aChar ); + sal_GlyphId nTemp = GetVerticalChar( aChar ); if( nTemp ) // is substitution possible nTemp = GetRawGlyphIndex( nTemp ); if( nTemp ) // substitute manually if sensible - nGlyphIndex = nTemp | (GF_GSUB | GF_ROTL); + aGlyphId = nTemp | (GF_GSUB | GF_ROTL); else nGlyphFlags |= GetVerticalFlags( aChar ); } else { // for vertical GSUB also compensate for nOrientation=2700 - nGlyphIndex = (*it).second; + aGlyphId = (*it).second; nGlyphFlags |= GF_GSUB | GF_ROTL; } } - if( nGlyphIndex != 0 ) - nGlyphIndex |= nGlyphFlags; + if( aGlyphId != 0 ) + aGlyphId |= nGlyphFlags; - return nGlyphIndex; + return aGlyphId; } // ----------------------------------------------------------------------- -int ServerFont::GetGlyphIndex( sal_UCS4 aChar ) const +sal_GlyphId ServerFont::GetGlyphIndex( sal_UCS4 aChar ) const { - int nGlyphIndex = GetRawGlyphIndex( aChar ); - nGlyphIndex = FixupGlyphIndex( nGlyphIndex, aChar ); - return nGlyphIndex; + sal_GlyphId aGlyphId = GetRawGlyphIndex( aChar ); + aGlyphId = FixupGlyphIndex( aGlyphId, aChar ); + return aGlyphId; } // ----------------------------------------------------------------------- @@ -1002,12 +1002,12 @@ static int lcl_GetCharWidth( FT_FaceRec_* pFaceFT, double fStretch, int nGlyphFl // ----------------------------------------------------------------------- -void ServerFont::InitGlyphData( int nGlyphIndex, GlyphData& rGD ) const +void ServerFont::InitGlyphData( sal_GlyphId aGlyphId, GlyphData& rGD ) const { FT_Activate_Size( maSizeFT ); int nGlyphFlags; - SplitGlyphFlags( *this, nGlyphIndex, nGlyphFlags ); + SplitGlyphFlags( *this, aGlyphId, nGlyphFlags ); int nLoadFlags = mnLoadFlags; @@ -1015,7 +1015,7 @@ void ServerFont::InitGlyphData( int nGlyphIndex, GlyphData& rGD ) const // nLoadFlags |= FT_LOAD_NO_BITMAP; FT_Error rc = -1; - rc = FT_Load_Glyph( maFaceFT, nGlyphIndex, nLoadFlags ); + rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags ); if( rc != FT_Err_Ok ) { @@ -1066,12 +1066,12 @@ bool ServerFont::GetAntialiasAdvice( void ) const // ----------------------------------------------------------------------- -bool ServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& rRawBitmap ) const +bool ServerFont::GetGlyphBitmap1( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) const { FT_Activate_Size( maSizeFT ); int nGlyphFlags; - SplitGlyphFlags( *this, nGlyphIndex, nGlyphFlags ); + SplitGlyphFlags( *this, aGlyphId, nGlyphFlags ); FT_Int nLoadFlags = mnLoadFlags; // #i70930# force mono-hinting for monochrome text @@ -1090,7 +1090,7 @@ bool ServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& rRawBitmap ) const nLoadFlags |= FT_LOAD_NO_BITMAP; FT_Error rc = -1; - rc = FT_Load_Glyph( maFaceFT, nGlyphIndex, nLoadFlags ); + rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags ); if( rc != FT_Err_Ok ) return false; @@ -1208,12 +1208,12 @@ bool ServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& rRawBitmap ) const // ----------------------------------------------------------------------- -bool ServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap ) const +bool ServerFont::GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) const { FT_Activate_Size( maSizeFT ); int nGlyphFlags; - SplitGlyphFlags( *this, nGlyphIndex, nGlyphFlags ); + SplitGlyphFlags( *this, aGlyphId, nGlyphFlags ); FT_Int nLoadFlags = mnLoadFlags; @@ -1227,7 +1227,7 @@ bool ServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap ) const nLoadFlags |= FT_LOAD_NO_BITMAP; FT_Error rc = -1; - rc = FT_Load_Glyph( maFaceFT, nGlyphIndex, nLoadFlags ); + rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags ); if( rc != FT_Err_Ok ) return false; @@ -1607,7 +1607,7 @@ static int FT_cubic_to( FT_Vector_CPtr p1, FT_Vector_CPtr p2, FT_Vector_CPtr p3, // ----------------------------------------------------------------------- -bool ServerFont::GetGlyphOutline( int nGlyphIndex, +bool ServerFont::GetGlyphOutline( sal_GlyphId aGlyphId, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) const { if( maSizeFT ) @@ -1616,7 +1616,7 @@ bool ServerFont::GetGlyphOutline( int nGlyphIndex, rB2DPolyPoly.clear(); int nGlyphFlags; - SplitGlyphFlags( *this, nGlyphIndex, nGlyphFlags ); + SplitGlyphFlags( *this, aGlyphId, nGlyphFlags ); FT_Int nLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_TRANSFORM; @@ -1625,7 +1625,7 @@ bool ServerFont::GetGlyphOutline( int nGlyphIndex, nLoadFlags |= FT_LOAD_TARGET_LIGHT; #endif - FT_Error rc = FT_Load_Glyph( maFaceFT, nGlyphIndex, nLoadFlags ); + FT_Error rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags ); if( rc != FT_Err_Ok ) return false; diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx index 5ac5510ffede..4ac5d82a1b9b 100644 --- a/vcl/generic/glyphs/glyphcache.cxx +++ b/vcl/generic/glyphs/glyphcache.cxx @@ -342,10 +342,10 @@ long ServerFont::Release() const } -GlyphData& ServerFont::GetGlyphData( int nGlyphIndex ) +GlyphData& ServerFont::GetGlyphData( sal_GlyphId aGlyphId ) { // usually the GlyphData is cached - GlyphList::iterator it = maGlyphList.find( nGlyphIndex ); + GlyphList::iterator it = maGlyphList.find( aGlyphId ); if( it != maGlyphList.end() ) { GlyphData& rGlyphData = it->second; GlyphCache::GetInstance().UsingGlyph( *this, rGlyphData ); @@ -353,9 +353,9 @@ GlyphData& ServerFont::GetGlyphData( int nGlyphIndex ) } // sometimes not => we need to create and initialize it ourselves - GlyphData& rGlyphData = maGlyphList[ nGlyphIndex ]; + GlyphData& rGlyphData = maGlyphList[ aGlyphId ]; mnBytesUsed += sizeof( GlyphData ); - InitGlyphData( nGlyphIndex, rGlyphData ); + InitGlyphData( aGlyphId, rGlyphData ); GlyphCache::GetInstance().AddedGlyph( *this, rGlyphData ); return rGlyphData; } -- cgit