[ooo-build-commit] .: vcl/inc vcl/source vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Sep 30 09:20:52 PDT 2010
vcl/inc/vcl/salgdi.hxx | 2 +-
vcl/source/gdi/outdev3.cxx | 19 +++++++++++++++++++
vcl/unx/headless/svpgdi.hxx | 2 +-
vcl/unx/headless/svppspgraphics.cxx | 2 +-
vcl/unx/headless/svppspgraphics.hxx | 2 +-
vcl/unx/headless/svptext.cxx | 9 ++++++---
vcl/unx/inc/pspgraphics.h | 2 +-
vcl/unx/inc/salgdi.h | 2 +-
vcl/unx/source/gdi/pspgraphics.cxx | 2 +-
vcl/unx/source/gdi/salgdi3.cxx | 13 ++++++++-----
10 files changed, 40 insertions(+), 15 deletions(-)
New commits:
commit b54ec0d1a7c536f0065e143be24a794093225493
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 30 16:50:58 2010 +0100
shrink replacement glyphs when they wouldn't fit on the line
diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx
index 991ff09..64789c2 100644
--- a/vcl/inc/vcl/salgdi.hxx
+++ b/vcl/inc/vcl/salgdi.hxx
@@ -233,7 +233,7 @@ public:
// release the fonts
void ReleaseFonts() { SetFont( NULL, 0 ); }
// get the current font's metrics
- virtual void GetFontMetric( ImplFontMetricData* ) = 0;
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel = 0 ) = 0;
// get kernign pairs of the current font
// return only PairCount if (pKernPairs == NULL)
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index c39be17..6a32c40 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -6058,6 +6058,10 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
rtl::OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear();
ImplFontSelectData aFontSelData = mpFontEntry->maFontSelData;
+
+ ImplFontMetricData aOrigMetric(aFontSelData);
+ mpGraphics->GetFontMetric(&aOrigMetric);
+
// when device specific font substitution may have been performed for
// the originally selected font then make sure that a fallback to that
// font is performed first
@@ -6102,7 +6106,22 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
}
#endif
+ ImplFontMetricData aSubstituteMetric(aFontSelData);
pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel );
+ mpGraphics->GetFontMetric(&aSubstituteMetric, nFallbackLevel);
+
+ long nOriginalHeight = aOrigMetric.mnAscent + aOrigMetric.mnDescent;
+ long nSubstituteHeight = aSubstituteMetric.mnAscent + aSubstituteMetric.mnDescent;
+ //Too tall, shrink it a bit. Need a better calculation to include extra
+ //factors and any extra wriggle room we might have available ?
+ if (nSubstituteHeight > nOriginalHeight)
+ {
+ float fScale = nOriginalHeight/(float)nSubstituteHeight;
+ long nOrigHeight = aFontSelData.mnHeight;
+ aFontSelData.mnHeight *= fScale;
+ pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel );
+ aFontSelData.mnHeight = nOrigHeight;
+ }
// create and add glyph fallback layout to multilayout
rLayoutArgs.ResetPos();
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index 41f5c13..7fc749d 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -86,7 +86,7 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
virtual ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 73227d6..58de99c 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -792,7 +792,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
}
}
-void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int )
{
const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
psp::PrintFontInfo aInfo;
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index 87cbb49..9981b37 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -105,7 +105,7 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
virtual ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx
index 5d2f48b..657501d 100644
--- a/vcl/unx/headless/svptext.cxx
+++ b/vcl/unx/headless/svptext.cxx
@@ -240,12 +240,15 @@ USHORT SvpSalGraphics::SetFont( ImplFontSelectData* pIFSD, int nFallbackLevel )
// ---------------------------------------------------------------------------
-void SvpSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void SvpSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
{
- if( m_pServerFont[0] != NULL )
+ if( nFallbackLevel >= MAX_FALLBACK )
+ return;
+
+ if( m_pServerFont[nFallbackLevel] != NULL )
{
long rDummyFactor;
- m_pServerFont[0]->FetchFontMetric( *pMetric, rDummyFactor );
+ m_pServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor );
}
}
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index 179e9a4..7592d75 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -102,7 +102,7 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* );
virtual ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index 2d2911f..ffd3062 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -253,7 +253,7 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* );
virtual ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index e62d72c..d98062e 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -885,7 +885,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
}
}
-void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int )
{
const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
psp::PrintFontInfo aInfo;
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index fc89fa7..1398d1d 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -1763,16 +1763,19 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
// ----------------------------------------------------------------------------
void
-X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric, int nFallbackLevel )
{
- if( mpServerFont[0] != NULL )
+ if( nFallbackLevel >= MAX_FALLBACK )
+ return;
+
+ if( mpServerFont[nFallbackLevel] != NULL )
{
long rDummyFactor;
- mpServerFont[0]->FetchFontMetric( *pMetric, rDummyFactor );
+ mpServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor );
}
- else if( mXFont[0] != NULL )
+ else if( mXFont[nFallbackLevel] != NULL )
{
- mXFont[0]->ToImplFontMetricData( pMetric );
+ mXFont[nFallbackLevel]->ToImplFontMetricData( pMetric );
if ( bFontVertical_ )
pMetric->mnOrientation = 0;
}
More information about the ooo-build-commit
mailing list