summaryrefslogtreecommitdiff
path: root/vcl/win/source
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2013-12-16 16:07:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-01-06 14:32:30 +0000
commita16aacd6474f02307341646ec08f9e1608a8615d (patch)
tree23d5a086d982d77329f2de6196c97c3139d9bdbf /vcl/win/source
parent8723bf714b6156396f30ac71c0268e5a51c76337 (diff)
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
Diffstat (limited to 'vcl/win/source')
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx62
-rw-r--r--vcl/win/source/gdi/winlayout.cxx20
2 files changed, 41 insertions, 41 deletions
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 7669b241d61a..07def604c0d3 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -2258,7 +2258,7 @@ void WinSalGraphics::ClearDevFontCache()
// -----------------------------------------------------------------------
-sal_Bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& rRect )
+bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
{
HDC hDC = getHDC();
@@ -2268,14 +2268,14 @@ sal_Bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& rRect
aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 );
UINT nGGOFlags = GGO_METRICS;
- if( !(nIndex & GF_ISCHAR) )
+ if( !(aGlyphId & GF_ISCHAR) )
nGGOFlags |= GGO_GLYPH_INDEX;
- nIndex &= GF_IDXMASK;
+ aGlyphId &= GF_IDXMASK;
GLYPHMETRICS aGM;
aGM.gmptGlyphOrigin.x = aGM.gmptGlyphOrigin.y = 0;
aGM.gmBlackBoxX = aGM.gmBlackBoxY = 0;
- DWORD nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat );
+ DWORD nSize = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGM, 0, NULL, &aMat );
if( nSize == GDI_ERROR )
return false;
@@ -2290,7 +2290,7 @@ sal_Bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& rRect
// -----------------------------------------------------------------------
-sal_Bool WinSalGraphics::GetGlyphOutline( sal_GlyphId nIndex,
+bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
::basegfx::B2DPolyPolygon& rB2DPolyPoly )
{
rB2DPolyPoly.clear();
@@ -2303,23 +2303,23 @@ sal_Bool WinSalGraphics::GetGlyphOutline( sal_GlyphId nIndex,
aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 );
UINT nGGOFlags = GGO_NATIVE;
- if( !(nIndex & GF_ISCHAR) )
+ if( !(aGlyphId & GF_ISCHAR) )
nGGOFlags |= GGO_GLYPH_INDEX;
- nIndex &= GF_IDXMASK;
+ aGlyphId &= GF_IDXMASK;
GLYPHMETRICS aGlyphMetrics;
- const DWORD nSize1 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat );
+ const DWORD nSize1 = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat );
if( !nSize1 ) // blank glyphs are ok
- return TRUE;
+ return true;
else if( nSize1 == GDI_ERROR )
- return FALSE;
+ return false;
- BYTE* pData = new BYTE[ nSize1 ];
- const DWORD nSize2 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags,
+ BYTE* pData = new BYTE[ nSize1 ];
+ const DWORD nSize2 = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags,
&aGlyphMetrics, nSize1, pData, &aMat );
if( nSize1 != nSize2 )
- return FALSE;
+ return false;
// TODO: avoid tools polygon by creating B2DPolygon directly
int nPtSize = 512;
@@ -2469,7 +2469,7 @@ sal_Bool WinSalGraphics::GetGlyphOutline( sal_GlyphId nIndex,
rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor));
}
- return TRUE;
+ return true;
}
// -----------------------------------------------------------------------
@@ -2533,7 +2533,7 @@ int ScopedTrueTypeFont::open(void * pBuffer, sal_uInt32 nLen,
}
sal_Bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
- const PhysicalFontFace* pFont, long* pGlyphIDs, sal_uInt8* pEncoding,
+ const PhysicalFontFace* pFont, sal_GlyphId* pGlyphIDs, sal_uInt8* pEncoding,
sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo )
{
// TODO: use more of the central font-subsetting code, move stuff there if needed
@@ -2576,18 +2576,18 @@ sal_Bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
const ImplFontCharMap* pCharMap = pWinFontData->GetImplFontCharMap();
pCharMap->AddReference();
- long nRealGlyphIds[ 256 ];
+ sal_GlyphId aRealGlyphIds[ 256 ];
for( int i = 0; i < nGlyphCount; ++i )
{
// TODO: remap notdef glyph if needed
// TODO: use GDI's GetGlyphIndices instead? Does it handle GSUB properly?
- sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
- if( pGlyphIDs[i] & GF_ISCHAR ) // remaining pseudo-glyphs need to be translated
- nGlyphIdx = pCharMap->GetGlyphIndex( nGlyphIdx );
- if( (pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0) // TODO: vertical substitution
+ sal_GlyphId aGlyphId = pGlyphIds[i] & GF_IDXMASK;
+ if( pGlyphIds[i] & GF_ISCHAR ) // remaining pseudo-glyphs need to be translated
+ aGlyphId = pCharMap->GetGlyphIndex( aGlyphId );
+ if( (pGlyphIds[i] & (GF_ROTMASK|GF_GSUB)) != 0) // TODO: vertical substitution
{/*####*/}
- nRealGlyphIds[i] = nGlyphIdx;
+ aRealGlyphIds[i] = aGlyphId;
}
pCharMap->DeReference(); // TODO: and and use a RAII object
@@ -2596,7 +2596,7 @@ sal_Bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
FILE* pOutFile = fopen( aToFile.getStr(), "wb" );
rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() );
bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL,
- nRealGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
+ aRealGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
fclose( pOutFile );
return bRC;
}
@@ -2636,21 +2636,21 @@ sal_Bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
for( i = 0; i < nGlyphCount; ++i )
{
aTempEncs[i] = pEncoding[i];
- sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
- if( pGlyphIDs[i] & GF_ISCHAR )
+ sal_GlyphId aGlyphId = pGlyphIds[i] & GF_IDXMASK;
+ if( pGlyphIds[i] & GF_ISCHAR )
{
- sal_Unicode cChar = static_cast<sal_Unicode>(nGlyphIdx); // TODO: sal_UCS4
- const bool bVertical = ((pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0);
- nGlyphIdx = ::MapChar( aSftTTF.get(), cChar, bVertical );
- if( (nGlyphIdx == 0) && pFont->IsSymbolFont() )
+ sal_Unicode cChar = static_cast<sal_Unicode>(aGlyphId); // TODO: sal_UCS4
+ const bool bVertical = ((pGlyphIds[i] & (GF_ROTMASK|GF_GSUB)) != 0);
+ aGlyphId = ::MapChar( aSftTTF.get(), cChar, bVertical );
+ if( (aGlyphId == 0) && pFont->IsSymbolFont() )
{
// #i12824# emulate symbol aliasing U+FXXX <-> U+0XXX
cChar = (cChar & 0xF000) ? (cChar & 0x00FF) : (cChar | 0xF000);
- nGlyphIdx = ::MapChar( aSftTTF.get(), cChar, bVertical );
+ aGlyphId = ::MapChar( aSftTTF.get(), cChar, bVertical );
}
}
- aShortIDs[i] = static_cast<sal_uInt16>( nGlyphIdx );
- if( !nGlyphIdx )
+ aShortIDs[i] = static_cast<sal_uInt16>( aGlyphId );
+ if( !aGlyphId )
if( nNotDef < 0 )
nNotDef = i; // first NotDef glyph found
}
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index e53dafffc562..b6bb33490d49 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -532,7 +532,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
// -----------------------------------------------------------------------
-int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int& nStart,
+int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPos, int& nStart,
long* pGlyphAdvances, int* pCharIndexes,
const PhysicalFontFace** /*pFallbackFonts*/ ) const
{
@@ -553,27 +553,27 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos,
int nCount = 0;
while( nCount < nLen )
{
- // update return values {nGlyphIndex,nCharPos,nGlyphAdvance}
- sal_GlyphId nGlyphIndex = mpOutGlyphs[ nStart ];
+ // update return values {aGlyphId,nCharPos,nGlyphAdvance}
+ sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ];
if( mbDisableGlyphs )
{
if( mnLayoutFlags & SAL_LAYOUT_VERTICAL )
{
- const sal_UCS4 cChar = static_cast<sal_UCS4>(nGlyphIndex & GF_IDXMASK);
+ const sal_UCS4 cChar = static_cast<sal_UCS4>(aGlyphId & GF_IDXMASK);
if( mrWinFontData.HasGSUBstitutions( mhDC )
&& mrWinFontData.IsGSUBstituted( cChar ) )
- nGlyphIndex |= GF_GSUB | GF_ROTL;
+ aGlyphId |= GF_GSUB | GF_ROTL;
else
{
- nGlyphIndex |= GetVerticalFlags( cChar );
- if( (nGlyphIndex & GF_ROTMASK) == 0 )
- nGlyphIndex |= GF_VERT;
+ aGlyphId |= GetVerticalFlags( cChar );
+ if( (aGlyphId & GF_ROTMASK) == 0 )
+ aGlyphId |= GF_VERT;
}
}
- nGlyphIndex |= GF_ISCHAR;
+ aGlyphId |= GF_ISCHAR;
}
++nCount;
- *(pGlyphs++) = nGlyphIndex;
+ *(pGlyphIds++) = aGlyphId;
if( pGlyphAdvances )
*(pGlyphAdvances++) = mpGlyphAdvances[ nStart ];
if( pCharIndexes )