diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-03 09:33:28 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-03 03:29:55 +0000 |
commit | 694ec8930ab7d7a54805ec598be84845b502772c (patch) | |
tree | 9e44148884d0f01e21b853512fccc7b971f2f1f3 /vcl/generic | |
parent | 91f41c3ec23eb063873db8a03c3f6806e2e68af8 (diff) |
vcl: convert ImplFontMetricData to accessor functions
Changed private variables to use accessor functions in ImplFontMetric.
It turns out there are some variables that are redundant as they are
already in ImplFontAttributes. These are:
- meFamilyType
- mbDevice
I also needed to change ImplFontMetric::GetSlant() to GetSlantType()
as the names conflicted.
Change-Id: Ic06a374fb929e3b2ffb18a6c66577c526c3b31a7
Reviewed-on: https://gerrit.libreoffice.org/21050
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/generic')
-rw-r--r-- | vcl/generic/fontmanager/fontconfig.cxx | 2 | ||||
-rw-r--r-- | vcl/generic/fontmanager/fontsubst.cxx | 10 | ||||
-rw-r--r-- | vcl/generic/glyphs/gcach_ftyp.cxx | 62 | ||||
-rw-r--r-- | vcl/generic/glyphs/glyphcache.cxx | 4 | ||||
-rw-r--r-- | vcl/generic/print/genpspgraphics.cxx | 22 |
5 files changed, 50 insertions, 50 deletions
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx index b663dffb7bd5..2e8622b6becc 100644 --- a/vcl/generic/fontmanager/fontconfig.cxx +++ b/vcl/generic/fontmanager/fontconfig.cxx @@ -990,7 +990,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi if (!aLangAttrib.isEmpty()) FcPatternAddString(pPattern, FC_LANG, reinterpret_cast<FcChar8 const *>(aLangAttrib.getStr())); - addtopattern(pPattern, rPattern.GetSlant(), rPattern.GetWeight(), + addtopattern(pPattern, rPattern.GetSlantType(), rPattern.GetWeight(), rPattern.GetWidthType(), rPattern.GetPitch()); // query fontconfig for a substitute diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx index 309cb1889af3..620bb9178a16 100644 --- a/vcl/generic/fontmanager/fontsubst.cxx +++ b/vcl/generic/fontmanager/fontsubst.cxx @@ -123,7 +123,7 @@ namespace ( rOrig.maTargetName == rNew.maSearchName && rOrig.GetWeight() == rNew.GetWeight() && - rOrig.GetSlant() == rNew.GetSlant() && + rOrig.GetSlantType() == rNew.GetSlantType() && rOrig.GetPitch() == rNew.GetPitch() && rOrig.GetWidthType() == rNew.GetWidthType() ); @@ -186,13 +186,13 @@ bool FcPreMatchSubstitution::FindFontSubstitute( FontSelectPattern &rFontSelData const OString aSubstName(OUStringToOString(aOut.maSearchName, RTL_TEXTENCODING_UTF8)); printf( "FcPreMatchSubstitution \"%s\" bipw=%d%d%d%d -> ", - aOrigName.getStr(), rFontSelData.GetWeight(), rFontSelData.GetSlant(), + aOrigName.getStr(), rFontSelData.GetWeight(), rFontSelData.GetSlantType(), rFontSelData.GetPitch(), rFontSelData.GetWidthType() ); if( !bHaveSubstitute ) printf( "no substitute available\n" ); else printf( "\"%s\" bipw=%d%d%d%d\n", aSubstName.getStr(), - aOut.GetWeight(), aOut.GetSlant(), aOut.GetPitch(), aOut.GetWidthType() ); + aOut.GetWeight(), aOut.GetSlantType(), aOut.GetPitch(), aOut.GetWidthType() ); #endif if( bHaveSubstitute ) @@ -234,13 +234,13 @@ bool FcGlyphFallbackSubstitution::FindFontSubstitute( FontSelectPattern& rFontSe const OString aSubstName(OUStringToOString(aOut.maSearchName, RTL_TEXTENCODING_UTF8)); printf( "FcGFSubstitution \"%s\" bipw=%d%d%d%d ->", - aOrigName.getStr(), rFontSelData.GetWeight(), rFontSelData.GetSlant(), + aOrigName.getStr(), rFontSelData.GetWeight(), rFontSelData.GetSlantType(), rFontSelData.GetPitch(), rFontSelData.GetWidthType() ); if( !bHaveSubstitute ) printf( "no substitute available\n" ); else printf( "\"%s\" bipw=%d%d%d%d\n", aSubstName.getStr(), - aOut.GetWeight(), aOut.GetSlant(), aOut.GetPitch(), aOut.GetWidthType() ); + aOut.GetWeight(), aOut.GetSlantType(), aOut.GetPitch(), aOut.GetWidthType() ); #endif if( bHaveSubstitute ) diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index a570548feb1b..7dea18bbf735 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -510,7 +510,7 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI ) mnLoadFlags |= FT_LOAD_IGNORE_TRANSFORM; #endif - mbArtItalic = (rFSD.GetSlant() != ITALIC_NONE && pFI->GetFontAttributes().GetSlant() == ITALIC_NONE); + mbArtItalic = (rFSD.GetSlantType() != ITALIC_NONE && pFI->GetFontAttributes().GetSlantType() == ITALIC_NONE); mbArtBold = (rFSD.GetWeight() > WEIGHT_MEDIUM && pFI->GetFontAttributes().GetWeight() <= WEIGHT_MEDIUM); if( mbArtBold ) { @@ -612,11 +612,11 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const { static_cast<ImplFontAttributes&>(rTo) = mpFontInfo->GetFontAttributes(); - rTo.mbScalableFont = true; // FIXME: Shouldn't this check FT_IS_SCALABLE( maFaceFT )? - rTo.mbTrueTypeFont = FT_IS_SFNT( maFaceFT ) != 0; - rTo.mbDevice = true; - rTo.mbKernableFont = FT_HAS_KERNING( maFaceFT ) != 0; - rTo.mnOrientation = GetFontSelData().mnOrientation; + rTo.SetScalableFlag( true ); // FIXME: Shouldn't this check FT_IS_SCALABLE( maFaceFT )? + rTo.SetTrueTypeFlag( FT_IS_SFNT( maFaceFT ) != 0 ); + rTo.SetBuiltInFontFlag( true ); + rTo.SetKernableFlag( FT_HAS_KERNING( maFaceFT ) != 0 ); + rTo.SetOrientation( GetFontSelData().mnOrientation ); //Always consider [star]symbol as symbol fonts if ( IsStarSymbol( rTo.GetFamilyName() ) ) @@ -629,11 +629,11 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const const TT_OS2* pOS2 = static_cast<const TT_OS2*>(FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 )); const double fScale = (double)GetFontSelData().mnHeight / maFaceFT->units_per_EM; - rTo.mnAscent = 0; - rTo.mnDescent = 0; - rTo.mnExtLeading = 0; - rTo.mnSlant = 0; - rTo.mnWidth = mnWidth; + rTo.SetAscent( 0 ); + rTo.SetDescent( 0 ); + rTo.SetExternalLeading( 0 ); + rTo.SetSlant( 0 ); + rTo.SetWidth( mnWidth ); // Calculating ascender and descender: // FreeType >= 2.4.6 does the right thing, so we just use what it gives us, @@ -644,49 +644,49 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const if (nFTVERSION >= 2406) { const FT_Size_Metrics& rMetrics = maFaceFT->size->metrics; - rTo.mnAscent = (rMetrics.ascender + 32) >> 6; - rTo.mnDescent = (-rMetrics.descender + 32) >> 6; - rTo.mnExtLeading = ((rMetrics.height + 32) >> 6) - (rTo.mnAscent + rTo.mnDescent); + rTo.SetAscent( (rMetrics.ascender + 32) >> 6 ); + rTo.SetDescent( (-rMetrics.descender + 32) >> 6 ); + rTo.SetExternalLeading( ((rMetrics.height + 32) >> 6) - (rTo.GetAscent() + rTo.GetDescent()) ); } else { const TT_HoriHeader* pHHea = static_cast<const TT_HoriHeader*>(FT_Get_Sfnt_Table(maFaceFT, ft_sfnt_hhea)); if (pHHea) { - rTo.mnAscent = pHHea->Ascender * fScale + 0.5; - rTo.mnDescent = -pHHea->Descender * fScale + 0.5; - rTo.mnExtLeading = pHHea->Line_Gap * fScale + 0.5; + rTo.SetAscent( pHHea->Ascender * fScale + 0.5 ); + rTo.SetDescent( -pHHea->Descender * fScale + 0.5 ); + rTo.SetExternalLeading( pHHea->Line_Gap * fScale + 0.5 ); } - if (!(rTo.mnAscent || rTo.mnDescent)) + if (!(rTo.GetAscent() || rTo.GetDescent())) { if (pOS2 && (pOS2->version != 0xFFFF)) { if (pOS2->sTypoAscender || pOS2->sTypoDescender) { - rTo.mnAscent = pOS2->sTypoAscender * fScale + 0.5; - rTo.mnDescent = -pOS2->sTypoDescender * fScale + 0.5; - rTo.mnExtLeading = pOS2->sTypoLineGap * fScale + 0.5; + rTo.SetAscent( pOS2->sTypoAscender * fScale + 0.5 ); + rTo.SetDescent( -pOS2->sTypoDescender * fScale + 0.5 ); + rTo.SetExternalLeading( pOS2->sTypoLineGap * fScale + 0.5 ); } else { - rTo.mnAscent = pOS2->usWinAscent * fScale + 0.5; - rTo.mnDescent = pOS2->usWinDescent * fScale + 0.5; - rTo.mnExtLeading = 0; + rTo.SetAscent( pOS2->usWinAscent * fScale + 0.5 ); + rTo.SetDescent( pOS2->usWinDescent * fScale + 0.5 ); + rTo.SetExternalLeading( 0 ); } } } - if (!(rTo.mnAscent || rTo.mnDescent)) + if (!(rTo.GetAscent() || rTo.GetDescent())) { const FT_Size_Metrics& rMetrics = maFaceFT->size->metrics; - rTo.mnAscent = (rMetrics.ascender + 32) >> 6; - rTo.mnDescent = (-rMetrics.descender + 32) >> 6; - rTo.mnExtLeading = ((rMetrics.height + 32) >> 6) - (rTo.mnAscent + rTo.mnDescent); + rTo.SetAscent( (rMetrics.ascender + 32) >> 6 ); + rTo.SetDescent( (-rMetrics.descender + 32) >> 6 ); + rTo.SetExternalLeading( ((rMetrics.height + 32) >> 6) - (rTo.GetAscent() + rTo.GetDescent() ) ); } } - rTo.mnIntLeading = rTo.mnAscent + rTo.mnDescent - (maFaceFT->units_per_EM * fScale + 0.5); + rTo.SetInternalLeading( rTo.GetAscent() + rTo.GetDescent() - (maFaceFT->units_per_EM * fScale + 0.5) ); if( pOS2 && (pOS2->version != 0xFFFF) ) { @@ -700,7 +700,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const case 5: rTo.SetFamilyType( FAMILY_DECORATIVE ); break; // TODO: is it reasonable to override the attribute with DONTKNOW? case 0: // fall through - default: rTo.meFamilyType = FAMILY_DONTKNOW; break; + default: rTo.SetFamilyType( FAMILY_DONTKNOW ); break; } switch( pOS2->panose[3] ) @@ -727,7 +727,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const { GlyphData aGlyphData; InitGlyphData( nKashidaGlyphId, aGlyphData ); - rTo.mnMinKashida = aGlyphData.GetMetric().GetCharWidth(); + rTo.SetMinKashida( aGlyphData.GetMetric().GetCharWidth() ); } } diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx index 1f69fd6ac844..a0a230331ae2 100644 --- a/vcl/generic/glyphs/glyphcache.cxx +++ b/vcl/generic/glyphs/glyphcache.cxx @@ -85,7 +85,7 @@ size_t GlyphCache::IFSD_Hash::operator()( const FontSelectPattern& rFontSelData nHash += rFontSelData.mnHeight; nHash += rFontSelData.mnOrientation; nHash += size_t(rFontSelData.mbVertical); - nHash += rFontSelData.GetSlant(); + nHash += rFontSelData.GetSlantType(); nHash += rFontSelData.GetWeight(); #if ENABLE_GRAPHITE nHash += rFontSelData.meLanguage; @@ -108,7 +108,7 @@ bool GlyphCache::IFSD_Equal::operator()( const FontSelectPattern& rA, const Font || (rA.mbNonAntialiased != rB.mbNonAntialiased) ) return false; - if( (rA.GetSlant() != rB.GetSlant()) + if( (rA.GetSlantType() != rB.GetSlantType()) || (rA.GetWeight() != rB.GetWeight()) ) return false; diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index f687ba28fea2..9af2857ae6f8 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -801,7 +801,7 @@ sal_uInt16 GenPspGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLeve // determine which font attributes need to be emulated bool bArtItalic = false; bool bArtBold = false; - if( pEntry->GetSlant() == ITALIC_OBLIQUE || pEntry->GetSlant() == ITALIC_NORMAL ) + if( pEntry->GetSlantType() == ITALIC_OBLIQUE || pEntry->GetSlantType() == ITALIC_NORMAL ) { FontItalic eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE ) @@ -920,23 +920,23 @@ void GenPspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int ) { ImplFontAttributes aDFA = Info2FontAttributes( aInfo ); static_cast<ImplFontAttributes&>(*pMetric) = aDFA; - pMetric->mbDevice = aDFA.IsBuiltInFont(); - pMetric->mbScalableFont = true; - pMetric->mbTrueTypeFont = false; // FIXME, needed? + pMetric->SetBuiltInFontFlag( aDFA.IsBuiltInFont() ); + pMetric->SetScalableFlag( true ); + pMetric->SetTrueTypeFlag( false ); // FIXME, needed? - pMetric->mnOrientation = m_pPrinterGfx->GetFontAngle(); - pMetric->mnSlant = 0; + pMetric->SetOrientation( m_pPrinterGfx->GetFontAngle() ); + pMetric->SetSlant( 0 ); sal_Int32 nTextHeight = m_pPrinterGfx->GetFontHeight(); sal_Int32 nTextWidth = m_pPrinterGfx->GetFontWidth(); if( ! nTextWidth ) nTextWidth = nTextHeight; - pMetric->mnWidth = nTextWidth; - pMetric->mnAscent = ( aInfo.m_nAscend * nTextHeight + 500 ) / 1000; - pMetric->mnDescent = ( aInfo.m_nDescend * nTextHeight + 500 ) / 1000; - pMetric->mnIntLeading = ( aInfo.m_nLeading * nTextHeight + 500 ) / 1000; - pMetric->mnExtLeading = 0; + pMetric->SetWidth( nTextWidth ); + pMetric->SetAscent( ( aInfo.m_nAscend * nTextHeight + 500 ) / 1000 ); + pMetric->SetDescent( ( aInfo.m_nDescend * nTextHeight + 500 ) / 1000 ); + pMetric->SetInternalLeading( ( aInfo.m_nLeading * nTextHeight + 500 ) / 1000 ); + pMetric->SetExternalLeading( 0 ); } } |