summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-12-08 05:57:40 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-12-11 00:22:05 +0000
commita597dc833966aba23d4b677e5bcd6f74b979fc9d (patch)
tree1d726a37763038278a9117628388dc55c1c969d1
parent0fb0a564bf9cb0f721e812ac4bfa70e951827bdd (diff)
sal_GlyphId is a simple glyph id now
No more cleverness. Change-Id: I760c602802961b37728c6987c4ade14fb02ca034 Reviewed-on: https://gerrit.libreoffice.org/31819 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r--vcl/inc/salglyphid.hxx4
-rw-r--r--vcl/quartz/ctfonts.cxx4
-rw-r--r--vcl/quartz/salgdi.cxx2
-rw-r--r--vcl/quartz/salgdicommon.cxx2
-rw-r--r--vcl/source/gdi/pdffontcache.cxx6
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rw-r--r--vcl/source/gdi/sallayout.cxx9
-rw-r--r--vcl/source/outdev/text.cxx2
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx2
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx4
-rw-r--r--vcl/unx/generic/glyphs/glyphcache.cxx4
-rw-r--r--vcl/win/gdi/salfont.cxx23
-rw-r--r--vcl/win/gdi/winlayout.cxx6
13 files changed, 23 insertions, 47 deletions
diff --git a/vcl/inc/salglyphid.hxx b/vcl/inc/salglyphid.hxx
index 72cf4fc2fe4e..6d5480e61130 100644
--- a/vcl/inc/salglyphid.hxx
+++ b/vcl/inc/salglyphid.hxx
@@ -19,13 +19,9 @@
#ifndef INCLUDED_VCL_INC_SALGLYPHID_HXX
#define INCLUDED_VCL_INC_SALGLYPHID_HXX
-// TODO: sal_GlyphId should become a class...
typedef sal_uInt32 sal_GlyphId;
// Glyph Flags
-#define GF_FLAGMASK 0xFF800000
-#define GF_IDXMASK ~GF_FLAGMASK
-
#ifdef _WIN32
// caution !!!
#define GF_VERT 0x02000000
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 52062eb86e21..f5ea6dbc45e2 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -154,7 +154,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect ) const
{
- CGGlyph nCGGlyph = rGlyph.maGlyphId & GF_IDXMASK;
+ CGGlyph nCGGlyph = rGlyph.maGlyphId;
CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ));
SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.11 kCTFontDefaultOrientation
@@ -229,7 +229,7 @@ bool CoreTextStyle::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPol
{
rResult.clear();
- CGGlyph nCGGlyph = rGlyph.maGlyphId & GF_IDXMASK;
+ CGGlyph nCGGlyph = rGlyph.maGlyphId;
CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ));
CGPathRef xPath = CTFontCreatePathForGlyph( pCTFont, nCGGlyph, nullptr );
if (!xPath)
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 0df8955fd404..e38f5d29f9e0 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -442,7 +442,7 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
}
}
- aGlyphIds.push_back(pGlyph->maGlyphId & GF_IDXMASK);
+ aGlyphIds.push_back(pGlyph->maGlyphId);
aGlyphPos.push_back(aGCPos);
aGlyphOrientation.push_back(bUprightGlyph);
}
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 57a930ab4a41..2222e062b54e 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -274,7 +274,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
{
aTempEncs[i] = pEncoding[i];
- sal_GlyphId aGlyphId(pGlyphIds[i] & GF_IDXMASK);
+ sal_GlyphId aGlyphId(pGlyphIds[i]);
aShortIDs[i] = static_cast<sal_uInt16>( aGlyphId );
if( !aGlyphId && nNotDef < 0 )
{
diff --git a/vcl/source/gdi/pdffontcache.cxx b/vcl/source/gdi/pdffontcache.cxx
index 8140db73ac5b..67a8614db142 100644
--- a/vcl/source/gdi/pdffontcache.cxx
+++ b/vcl/source/gdi/pdffontcache.cxx
@@ -58,10 +58,8 @@ sal_Int32 PDFFontCache::getGlyphWidth( const PhysicalFontFace* pFont, sal_GlyphI
}
if( ! rFontData.m_nWidths.empty() )
{
- sal_GlyphId nIndex = nGlyph;
- nIndex &= GF_IDXMASK;
- if( nIndex < rFontData.m_nWidths.size() )
- nWidth = rFontData.m_nWidths[ nIndex ];
+ if (nGlyph < rFontData.m_nWidths.size())
+ nWidth = rFontData.m_nWidths[nGlyph];
}
return nWidth;
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index ab0559403c4d..241324d5b56a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8144,7 +8144,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
sal_Ucs* pCurUnicode = pUnicodes;
for( int i = 0; i < nGlyphs; pCurUnicode += pUnicodesPerGlyph[i] , i++ )
{
- const int nFontGlyphId = pGlyphs[i]->maGlyphId & GF_IDXMASK;
+ const int nFontGlyphId = pGlyphs[i]->maGlyphId;
const PhysicalFontFace* pCurrentFont = pFallbackFonts[i] ? pFallbackFonts[i] : pDevFont;
FontSubset& rSubset = m_aSubsets[ pCurrentFont ];
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index bdbb28d56bd9..1567d60a7eea 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -728,7 +728,7 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, Rectangle& rRect ) cons
bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph )
{
bool bRet = false;
- bRet = ((nGlyph & GF_IDXMASK) == 3);
+ bRet = (nGlyph == 3);
return bRet;
}
@@ -973,7 +973,6 @@ int GenericSalLayout::GetNextGlyphs(int nLen, const GlyphItem** pGlyphs,
// find more glyphs which can be merged into one drawing instruction
int nCount = 0;
long nYPos = pGlyphIter->maLinearPos.Y();
- long nOldFlags = pGlyphIter->maGlyphId;
for(;;)
{
// update return data with glyph info
@@ -1003,12 +1002,6 @@ int GenericSalLayout::GetNextGlyphs(int nLen, const GlyphItem** pGlyphs,
int n = pGlyphIter->mnCharPos;
if( (n < mnMinCharPos) || (mnEndCharPos <= n) )
break;
-
- // stop when glyph flags change
- if( (nOldFlags ^ pGlyphIter->maGlyphId) & GF_FLAGMASK )
- break;
-
- nOldFlags = pGlyphIter->maGlyphId; // &GF_FLAGMASK not needed for test above
}
aRelativePos.X() /= mnUnitsPerPixel;
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 2d6682208f83..c94b21df0fa9 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2394,7 +2394,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c
while (pLayout->GetNextGlyphs(1, &pGlyph, aPos, nStart))
{
SystemGlyphData aSystemGlyph;
- aSystemGlyph.index = static_cast<unsigned long> (pGlyph->maGlyphId & GF_IDXMASK);
+ aSystemGlyph.index = static_cast<unsigned long> (pGlyph->maGlyphId);
aSystemGlyph.x = aPos.X();
aSystemGlyph.y = aPos.Y();
int nLevel = pGlyph->mnFallbackLevel;
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index ec025b814e30..b3f61657b7b6 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -178,7 +178,7 @@ void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout)
while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
{
cairo_glyph_t aGlyph;
- aGlyph.index = pGlyph->maGlyphId & GF_IDXMASK;
+ aGlyph.index = pGlyph->maGlyphId;
aGlyph.x = aPos.X();
aGlyph.y = aPos.Y();
cairo_glyphs.push_back(aGlyph);
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 039ffad52b5a..cc5683c93a60 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -685,7 +685,7 @@ void FreetypeFont::InitGlyphData(const GlyphItem& rGlyph, GlyphData& rGD ) const
{
FT_Activate_Size( maSizeFT );
- FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId & GF_IDXMASK, mnLoadFlags);
+ FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId, mnLoadFlags);
if( rc != FT_Err_Ok )
{
@@ -998,7 +998,7 @@ bool FreetypeFont::GetGlyphOutline(const GlyphItem& rGlyph,
nLoadFlags |= FT_LOAD_TARGET_LIGHT;
#endif
- FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId & GF_IDXMASK, nLoadFlags);
+ FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId, nLoadFlags);
if( rc != FT_Err_Ok )
return false;
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index b41f7c08c376..103fc5468793 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -307,7 +307,7 @@ long FreetypeFont::Release() const
const GlyphMetric& FreetypeFont::GetGlyphMetric(const GlyphItem& rGlyph)
{
// usually the GlyphData is cached
- GlyphList::iterator it = maGlyphList.find(rGlyph.maGlyphId & GF_IDXMASK);
+ GlyphList::iterator it = maGlyphList.find(rGlyph.maGlyphId);
if( it != maGlyphList.end() ) {
GlyphData& rGlyphData = it->second;
GlyphCache::GetInstance().UsingGlyph( *this, rGlyphData );
@@ -315,7 +315,7 @@ const GlyphMetric& FreetypeFont::GetGlyphMetric(const GlyphItem& rGlyph)
}
// sometimes not => we need to create and initialize it ourselves
- GlyphData& rGlyphData = maGlyphList[rGlyph.maGlyphId & GF_IDXMASK];
+ GlyphData& rGlyphData = maGlyphList[rGlyph.maGlyphId];
mnBytesUsed += sizeof( GlyphData );
InitGlyphData(rGlyph, rGlyphData);
GlyphCache::GetInstance().AddedGlyph( *this, rGlyphData );
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 5d2255a8c5f6..65c909ffb1c7 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1368,7 +1368,7 @@ bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect
GLYPHMETRICS aGM;
aGM.gmptGlyphOrigin.x = aGM.gmptGlyphOrigin.y = 0;
aGM.gmBlackBoxX = aGM.gmBlackBoxY = 0;
- DWORD nSize = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId & GF_IDXMASK, nGGOFlags, &aGM, 0, nullptr, &aMat);
+ DWORD nSize = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId, nGGOFlags, &aGM, 0, nullptr, &aMat);
if( nSize == GDI_ERROR )
return false;
@@ -1397,14 +1397,14 @@ bool WinSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph,
nGGOFlags |= GGO_GLYPH_INDEX;
GLYPHMETRICS aGlyphMetrics;
- const DWORD nSize1 = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId & GF_IDXMASK, nGGOFlags, &aGlyphMetrics, 0, nullptr, &aMat);
+ const DWORD nSize1 = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId, nGGOFlags, &aGlyphMetrics, 0, nullptr, &aMat);
if( !nSize1 ) // blank glyphs are ok
return true;
else if( nSize1 == GDI_ERROR )
return false;
BYTE* pData = new BYTE[ nSize1 ];
- const DWORD nSize2 = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId & GF_IDXMASK, nGGOFlags,
+ const DWORD nSize2 = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId, nGGOFlags,
&aGlyphMetrics, nSize1, pData, &aMat );
if( nSize1 != nSize2 )
@@ -1661,23 +1661,13 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
{
pWinFontData->UpdateFromHDC( getHDC() );
FontCharMapRef xFontCharMap = pWinFontData->GetFontCharMap();
-
- 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_GlyphId aGlyphId = pGlyphIds[i] & GF_IDXMASK;
- aRealGlyphIds[i] = aGlyphId;
- }
-
xFontCharMap = nullptr;
// provide a font subset from the CFF-table
FILE* pOutFile = fopen( aToFile.getStr(), "wb" );
rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() );
bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, nullptr,
- aRealGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
+ pGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
fclose( pOutFile );
return bRC;
}
@@ -1717,9 +1707,8 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
for( i = 0; i < nGlyphCount; ++i )
{
aTempEncs[i] = pEncoding[i];
- sal_GlyphId aGlyphId = pGlyphIds[i] & GF_IDXMASK;
- aShortIDs[i] = static_cast<sal_uInt16>( aGlyphId );
- if( !aGlyphId )
+ aShortIDs[i] = static_cast<sal_uInt16>(pGlyphIds[i]);
+ if (!aShortIDs[i])
if( nNotDef < 0 )
nNotDef = i; // first NotDef glyph found
}
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 8b218630d531..708c931b0e05 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -294,7 +294,7 @@ bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC,
while (rLayout.GetNextGlyphs(1, &pGlyph, *pPos, *pGetNextGlypInfo))
{
bGlyphs = true;
- WORD glyphWStr[] = { pGlyph->maGlyphId & GF_IDXMASK };
+ WORD glyphWStr[] = { pGlyph->maGlyphId };
if (pGlyph->IsVertical())
glyphWStr[0] |= GF_VERT;
ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), 1, nullptr);
@@ -386,7 +386,7 @@ bool D2DWriteTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC,
while (rLayout.GetNextGlyphs(1, &pGlyph, *pPos, *pGetNextGlypInfo))
{
bGlyphs = true;
- UINT16 glyphIndices[] = { pGlyph->maGlyphId & GF_IDXMASK };
+ UINT16 glyphIndices[] = { pGlyph->maGlyphId };
FLOAT glyphAdvances[] = { pGlyph->mnNewWidth };
DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
D2D1_POINT_2F baseline = { pPos->X() - bounds.Left(), pPos->Y() - bounds.Top() };
@@ -545,7 +545,7 @@ bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout const &rLayout, Rectangl
while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
{
positions.push_back(aPos);
- indices.push_back(pGlyph->maGlyphId & GF_IDXMASK);
+ indices.push_back(pGlyph->maGlyphId);
vertical.push_back(pGlyph->IsVertical());
}