[PATCH] Change public variables of class ImplDevFontAttributes to pr...
navin patidar (via Code Review)
gerrit at gerrit.libreoffice.org
Mon Jan 7 08:25:32 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1565
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/65/1565/1
Change public variables of class ImplDevFontAttributes to private.
Change-Id: I256a1ca329f715270ba31261b16858341c91fc26
---
M vcl/generic/glyphs/gcach_ftyp.cxx
M vcl/generic/print/genpspgraphics.cxx
M vcl/headless/svptext.cxx
M vcl/inc/outfont.hxx
M vcl/source/gdi/outdev3.cxx
M vcl/source/gdi/pdfwriter_impl.cxx
M vcl/unx/generic/gdi/salgdi3.cxx
7 files changed, 51 insertions(+), 44 deletions(-)
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index de44e31..591fd46 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -315,12 +315,12 @@
mpExtraKernInfo( pExtraKernInfo )
{
// prefer font with low ID
- maDevFontAttributes.mnQuality += 10000 - nFontId;
+ maDevFontAttributes.SetQuality( maDevFontAttributes.GetQuality() + (10000 - nFontId) );
// prefer font with matching file names
- maDevFontAttributes.mnQuality += mpFontFile->GetLangBoost();
+ maDevFontAttributes.SetQuality( maDevFontAttributes.GetQuality() + mpFontFile->GetLangBoost() );
// prefer font with more external info
if( pExtraKernInfo )
- maDevFontAttributes.mnQuality += 100;
+ maDevFontAttributes.SetQuality( maDevFontAttributes.GetQuality() + 100 );
}
// -----------------------------------------------------------------------
@@ -619,8 +619,8 @@
: PhysicalFontFace( rDFA, IFTSFONT_MAGIC ),
mpFtFontInfo( pFI )
{
- mbDevice = false;
- mbOrientation = true;
+ SetDevice( false );
+ SetRotatable( true );
}
// -----------------------------------------------------------------------
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 7b2ce32..1b5d592 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -932,7 +932,7 @@
{
ImplDevFontAttributes aDFA = Info2DevFontAttributes( aInfo );
static_cast<ImplFontAttributes&>(*pMetric) = aDFA;
- pMetric->mbDevice = aDFA.mbDevice;
+ pMetric->mbDevice = aDFA.IsDeviceFont();
pMetric->mbScalableFont = true;
pMetric->mnOrientation = m_pPrinterGfx->GetFontAngle();
@@ -1132,42 +1132,43 @@
aDFA.SetWidthType( rInfo.m_eWidth );
aDFA.SetPitch( rInfo.m_ePitch );
aDFA.SetSymbolFlag( (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL) );
- aDFA.mbSubsettable = rInfo.m_bSubsettable;
- aDFA.mbEmbeddable = rInfo.m_bEmbeddable;
+ aDFA.SetSubsettable( rInfo.m_bSubsettable );
+ aDFA.SetEmbeddable( rInfo.m_bEmbeddable );
switch( rInfo.m_eType )
{
case psp::fonttype::Builtin:
- aDFA.mnQuality = 1024;
- aDFA.mbDevice = true;
+ aDFA.SetQuality( 1024 );
+ aDFA.SetDevice( true );
break;
case psp::fonttype::TrueType:
- aDFA.mnQuality = 512;
- aDFA.mbDevice = false;
+ aDFA.SetQuality( 512 );
+ aDFA.SetDevice( false );
break;
case psp::fonttype::Type1:
- aDFA.mnQuality = 0;
- aDFA.mbDevice = false;
+ aDFA.SetQuality( 0 );
+ aDFA.SetDevice( false );
break;
default:
- aDFA.mnQuality = 0;
- aDFA.mbDevice = false;
+ aDFA.SetQuality( 0 );
+ aDFA.SetDevice( false );
break;
}
- aDFA.mbOrientation = true;
+ aDFA.SetRotatable( true );
// add font family name aliases
+ String sMapNames = aDFA.GetAliasNames();
::std::list< OUString >::const_iterator it = rInfo.m_aAliases.begin();
bool bHasMapNames = false;
for(; it != rInfo.m_aAliases.end(); ++it )
{
if( bHasMapNames )
- aDFA.maMapNames.Append( ';' );
- aDFA.maMapNames.Append( (*it).getStr() );
- bHasMapNames = true;
+ sMapNames.Append( ';' );
+ sMapNames.Append( (*it).getStr() );
+ bHasMapNames = true;
}
-
+ aDFA.SetMapNames( sMapNames );
#if OSL_DEBUG_LEVEL > 2
if( bHasMapNames )
{
@@ -1232,7 +1233,8 @@
}
ImplPspFontData* pFD = new ImplPspFontData( aInfo );
- pFD->mnQuality += nQuality;
+ nQuality += pFD->GetQuality();
+ pFD->SetQuality( nQuality );
pFontList->Add( pFD );
}
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 834f6a0..327f356 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -339,7 +339,7 @@
// inform GlyphCache about this font provided by the PsPrint subsystem
ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo );
- aDFA.mnQuality += 4096;
+ aDFA.SetQuality( aDFA.GetQuality() + 4096 );
const rtl::OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA, pExtraKernInfo );
}
diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx
index 53ec909..0fbdb1c 100644
--- a/vcl/inc/outfont.hxx
+++ b/vcl/inc/outfont.hxx
@@ -101,8 +101,13 @@
bool IsDeviceFont() const { return mbDevice; }
bool IsEmbeddable() const { return mbEmbeddable; }
bool IsSubsettable() const { return mbSubsettable; }
-
-public: // TODO: hide members behind accessor methods
+ void SetMapNames(const String sMapNames) { maMapNames = sMapNames; }
+ void SetRotatable(const bool bOrientation) { mbOrientation = bOrientation; }
+ void SetQuality(const bool bQuality) { mnQuality = bQuality; }
+ void SetDevice(const bool bDevice) { mbDevice = bDevice; }
+ void SetSubsettable(const bool bSubsettable) { mbSubsettable = bSubsettable; }
+ void SetEmbeddable(const bool bEmbeddable) { mbEmbeddable = mbEmbeddable; }
+private:
String maMapNames; // List of family name aliass separated with ';'
int mnQuality; // Quality (used when similar fonts compete)
bool mbOrientation; // true: physical font can be rotated
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 6d3b02e..eb33309 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -881,7 +881,7 @@
nMatch += 600;
}
- if( mbDevice )
+ if( IsDeviceFont() )
nMatch += 1;
int nHeightMatch = 0;
@@ -1052,10 +1052,10 @@
if( !mpFirst )
{
maName = pNewData->GetFamilyName();
- maMapNames = pNewData->maMapNames;
+ maMapNames = pNewData->GetAliasNames();
meFamily = pNewData->GetFamilyType();
mePitch = pNewData->GetPitch();
- mnMinQuality = pNewData->mnQuality;
+ mnMinQuality = pNewData->GetQuality();
}
else
{
@@ -1063,8 +1063,8 @@
meFamily = pNewData->GetFamilyType();
if( mePitch == PITCH_DONTKNOW )
mePitch = pNewData->GetPitch();
- if( mnMinQuality > pNewData->mnQuality )
- mnMinQuality = pNewData->mnQuality;
+ if( mnMinQuality > pNewData->GetQuality() )
+ mnMinQuality = pNewData->GetQuality();
}
// set attributes for attribute based font matching
@@ -1122,12 +1122,12 @@
break;
// ignore duplicate if its quality is worse
- if( pNewData->mnQuality < pData->mnQuality )
+ if( pNewData->GetQuality() < pData->GetQuality() )
return false;
// keep the device font if its quality is good enough
- if( (pNewData->mnQuality == pData->mnQuality)
- && (pData->mbDevice || !pNewData->mbDevice) )
+ if( (pNewData->GetQuality() == pData->GetQuality())
+ && (pData->IsDeviceFont() || !pNewData->IsDeviceFont()) )
return false;
// replace existing font face with a better one
@@ -3401,7 +3401,7 @@
{
SetFamilyName( rFontSelData.mpFontData->GetFamilyName() );
SetStyleName( rFontSelData.mpFontData->GetStyleName() );
- mbDevice = rFontSelData.mpFontData->mbDevice;
+ mbDevice = rFontSelData.mpFontData->IsDeviceFont();
mbKernableFont = true;
}
else
@@ -7314,7 +7314,7 @@
aFontInfo.SetWidthType( rData.GetWidthType() );
if( rData.IsScalable() )
aFontInfo.mpImplMetric->mnMiscFlags |= ImplFontMetric::SCALABLE_FLAG;
- if( rData.mbDevice )
+ if( rData.IsDeviceFont() )
aFontInfo.mpImplMetric->mnMiscFlags |= ImplFontMetric::DEVICE_FLAG;
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 83f5753..e87b5dd 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2301,11 +2301,11 @@
aDFA.SetItalic( rBuiltin.m_eItalic );
aDFA.SetWidthType( rBuiltin.m_eWidthType );
- aDFA.mbOrientation = true;
- aDFA.mbDevice = true;
- aDFA.mnQuality = 50000;
- aDFA.mbSubsettable = false;
- aDFA.mbEmbeddable = false;
+ aDFA.SetRotatable( true );
+ aDFA.SetQuality( true );
+ aDFA.SetQuality( 50000 );
+ aDFA.SetSubsettable( false );
+ aDFA.SetEmbeddable( false );
return aDFA;
}
@@ -3179,7 +3179,7 @@
}
}
}
- else if( pFont->mbSubsettable )
+ else if( pFont->IsSubsettable() )
{
aSubType = rtl::OString( "/TrueType" );
Int32Vector aGlyphWidths;
@@ -7258,7 +7258,7 @@
pGlyphWidths[i] = pBuiltinFont->m_aWidths[ nFontGlyphId & 0x00ff ];
}
}
- else if( pCurrentFont->mbSubsettable )
+ else if( pCurrentFont->IsSubsettable() )
{
FontSubset& rSubset = m_aSubsets[ pCurrentFont ];
// search for font specific glyphID
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index fb7027e..1964f2d 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -552,7 +552,7 @@
// inform glyph cache of new font
ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo );
- aDFA.mnQuality += 5800;
+ aDFA.SetQuality( aDFA.GetQuality() + 5800 );
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
@@ -602,7 +602,7 @@
// inform GlyphCache about this font provided by the PsPrint subsystem
ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo );
- aDFA.mnQuality += 4096;
+ aDFA.SetQuality( aDFA.GetQuality() + 4096 );
const rtl::OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA, pExtraKernInfo );
}
--
To view, visit https://gerrit.libreoffice.org/1565
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I256a1ca329f715270ba31261b16858341c91fc26
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: navin patidar <patidar at kacst.edu.sa>
More information about the LibreOffice
mailing list