summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-12-26 15:58:21 +0100
committerKhaled Hosny <khaledhosny@eglug.org>2018-05-07 23:03:37 +0200
commit083b7ca26bbf4b9bad2922520caaf5c0227dac5e (patch)
treeb33576cd90c64cb2ede5ab1a930b11828f110105 /vcl/source
parent1ca1886d46f38a0759ab466e6a4a8c3c0866c523 (diff)
Move PhysicalFontFace member of FontSelectPattern
A FontSelectPattern describes a general font request. It can be used to find the best matching LogicalFontInstance. The instance will be created based on a PhysicalFontFace, which is really a factory since commit 8b700794b2746070814e9ff416ecd7bbb1c902e7. Following this workflow, this moves the PhysicalFontFace pointer to the instance and makes it constant. Which leaves some special symbol font handling code in the hash and instance lookup code path. It used to query the font face directly from the instance. I'm not sure of the correct handling. The related commits where made to fix #i89002#, which has an attached test document. 1. commit 849f618270da313f9339dda29a9f35938434c91d 2. commit 8c9823d311fdf8092cc75873e4565325d204a658 The document is as broken as it was before the patch. The symbol substitution still works, but the 'Q's are missing when displaying a symbol font. I also don't understand all the reinterpret_casts for fake font ids. I guess this was used to prevent the crashes I see, where a PhysicalFontFace referenced in a valid LogicalFontInstance is freed and a later FontId check in the GlyphCache crashes. So this now checks for a valid cache instead. Change-Id: If8ee5a6288e66cfa4c419289fbdd5b5da128c6ea Reviewed-on: https://gerrit.libreoffice.org/47279 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/font/PhysicalFontFace.cxx2
-rw-r--r--vcl/source/font/fontcache.cxx73
-rw-r--r--vcl/source/font/fontinstance.cxx9
-rw-r--r--vcl/source/font/fontmetric.cxx8
-rw-r--r--vcl/source/font/fontselect.cxx2
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx11
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx14
-rw-r--r--vcl/source/gdi/print.cxx2
-rw-r--r--vcl/source/outdev/font.cxx26
-rw-r--r--vcl/source/outdev/text.cxx5
-rw-r--r--vcl/source/window/window.cxx2
11 files changed, 67 insertions, 87 deletions
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index 04ebff2a8ffb..40948c41e77e 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -39,7 +39,7 @@ PhysicalFontFace::PhysicalFontFace( const FontAttributes& rDFA )
LogicalFontInstance* PhysicalFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const
{
- return new LogicalFontInstance(rFSD);
+ return new LogicalFontInstance(*this, rFSD);
}
sal_Int32 PhysicalFontFace::CompareIgnoreSize( const PhysicalFontFace& rOther ) const
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index f52eb6e30e16..1aa5f3e4c700 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -59,10 +59,7 @@ bool ImplFontCache::IFSD_Equal::operator()(const FontSelectPattern& rA, const Fo
// Symbol fonts may recode from one type to another So they are only
// safely equivalent for equal targets
- if (
- (rA.mpFontData && rA.mpFontData->IsSymbolFont()) ||
- (rB.mpFontData && rB.mpFontData->IsSymbolFont())
- )
+ if (rA.IsSymbolFont() && rB.IsSymbolFont())
{
if (rA.maTargetName != rB.maTargetName)
return false;
@@ -85,7 +82,7 @@ bool ImplFontCache::IFSD_Equal::operator()(const FontSelectPattern& rA, const Fo
}
ImplFontCache::ImplFontCache()
-: mpFirstEntry( nullptr ),
+: mpLastHitCacheEntry( nullptr ),
mnRef0Count( 0 )
{}
@@ -94,29 +91,31 @@ ImplFontCache::~ImplFontCache()
for (auto const& fontInstance : maFontInstanceList)
{
LogicalFontInstance* pFontInstance = fontInstance.second;
- delete pFontInstance;
+ if (pFontInstance->mnRefCount)
+ pFontInstance->mpFontCache = nullptr;
+ else
+ delete pFontInstance;
}
}
LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList,
const vcl::Font& rFont, const Size& rSize, float fExactHeight )
{
- const OUString& aSearchName = rFont.GetFamilyName();
-
// initialize internal font request object
- FontSelectPattern aFontSelData( rFont, aSearchName, rSize, fExactHeight );
+ FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight);
return GetFontInstance( pFontList, aFontSelData );
}
LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList,
FontSelectPattern& aFontSelData )
{
- // check if a directly matching logical font instance is already cached,
- // the most recently used font usually has a hit rate of >50%
LogicalFontInstance *pFontInstance = nullptr;
PhysicalFontFamily* pFontFamily = nullptr;
- if( mpFirstEntry && IFSD_Equal()( aFontSelData, mpFirstEntry->maFontSelData ) )
- pFontInstance = mpFirstEntry;
+
+ // check if a directly matching logical font instance is already cached,
+ // the most recently used font usually has a hit rate of >50%
+ if (mpLastHitCacheEntry && IFSD_Equal()(aFontSelData, mpLastHitCacheEntry->GetFontSelectPattern()))
+ pFontInstance = mpLastHitCacheEntry;
else
{
FontInstanceList::iterator it = maFontInstanceList.find( aFontSelData );
@@ -130,34 +129,10 @@ LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection cons
pFontFamily = pFontList->FindFontFamily( aFontSelData );
SAL_WARN_IF( (pFontFamily == nullptr), "vcl", "ImplFontCache::Get() No logical font found!" );
if( pFontFamily )
- aFontSelData.maSearchName = pFontFamily->GetSearchName();
-
- // check if an indirectly matching logical font instance is already cached
- FontInstanceList::iterator it = maFontInstanceList.find( aFontSelData );
- if( it != maFontInstanceList.end() )
{
- // we have an indirect cache hit
- pFontInstance = (*it).second;
- }
- }
-
- PhysicalFontFace* pFontData = nullptr;
-
- if (!pFontInstance && pFontFamily)// no cache hit => find the best matching physical font face
- {
- bool bOrigWasSymbol = aFontSelData.mpFontData && aFontSelData.mpFontData->IsSymbolFont();
- pFontData = pFontFamily->FindBestFontFace( aFontSelData );
- aFontSelData.mpFontData = pFontData;
- bool bNewIsSymbol = aFontSelData.mpFontData && aFontSelData.mpFontData->IsSymbolFont();
+ aFontSelData.maSearchName = pFontFamily->GetSearchName();
- if (bNewIsSymbol != bOrigWasSymbol)
- {
- // it is possible, though generally unlikely, that at this point we
- // will attempt to use a symbol font as a last-ditch fallback for a
- // non-symbol font request or vice versa, and by changing
- // aFontSelData.mpFontData to/from a symbol font we may now find
- // something in the cache that can be reused which previously
- // wasn't a candidate
+ // check if an indirectly matching logical font instance is already cached
FontInstanceList::iterator it = maFontInstanceList.find( aFontSelData );
if( it != maFontInstanceList.end() )
pFontInstance = (*it).second;
@@ -169,9 +144,10 @@ LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection cons
// increase the font instance's reference count
pFontInstance->Acquire();
}
-
- if (!pFontInstance && pFontData)// still no cache hit => create a new font instance
+ else if (pFontFamily) // still no cache hit => create a new font instance
{
+ PhysicalFontFace* pFontData = pFontFamily->FindBestFontFace(aFontSelData);
+
// create a new logical font instance from this physical font face
pFontInstance = pFontData->CreateFontInstance( aFontSelData );
pFontInstance->mpFontCache = this;
@@ -197,10 +173,14 @@ LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection cons
#endif
// add the new entry to the cache
- maFontInstanceList[ aFontSelData ] = pFontInstance;
+#ifndef NDEBUG
+ auto aResult =
+#endif
+ maFontInstanceList.insert({aFontSelData, pFontInstance});
+ assert(aResult.second);
}
- mpFirstEntry = pFontInstance;
+ mpLastHitCacheEntry = pFontInstance;
return pFontInstance;
}
@@ -279,8 +259,8 @@ void ImplFontCache::Release(LogicalFontInstance* pFontInstance)
--mnRef0Count;
assert(mnRef0Count>=0 && "ImplFontCache::Release() - refcount0 underflow");
- if( mpFirstEntry == pFontEntry )
- mpFirstEntry = nullptr;
+ if (mpLastHitCacheEntry == pFontEntry)
+ mpLastHitCacheEntry = nullptr;
}
assert(mnRef0Count==0 && "ImplFontCache::Release() - refcount0 mismatch");
@@ -327,11 +307,10 @@ void ImplFontCache::Invalidate()
}
// #112304# make sure the font cache is really clean
- mpFirstEntry = nullptr;
+ mpLastHitCacheEntry = nullptr;
maFontInstanceList.clear();
assert(mnRef0Count==0 && "ImplFontCache::Invalidate() - mnRef0Count non-zero");
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 85383399abff..5f9ac49afcf7 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -37,9 +37,8 @@ namespace std
}
-LogicalFontInstance::LogicalFontInstance( const FontSelectPattern& rFontSelData )
- : maFontSelData( rFontSelData )
- , mxFontMetric( new ImplFontMetricData( rFontSelData ))
+LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const FontSelectPattern& rFontSelData )
+ : mxFontMetric( new ImplFontMetricData( rFontSelData ))
, mpConversion( nullptr )
, mnLineHeight( 0 )
, mnOwnOrientation( 0 )
@@ -47,8 +46,10 @@ LogicalFontInstance::LogicalFontInstance( const FontSelectPattern& rFontSelData
, mbInit( false )
, mpFontCache( nullptr )
, mnRefCount( 1 )
+ , m_aFontSelData(rFontSelData)
+ , m_pFontFace(&rFontFace)
{
- maFontSelData.mpFontInstance = this;
+ const_cast<FontSelectPattern*>(&m_aFontSelData)->mpFontInstance = this;
}
LogicalFontInstance::~LogicalFontInstance()
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 1351b9167d4b..b619219c44ce 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -21,6 +21,8 @@
#include <vcl/fontcharmap.hxx>
#include <vcl/metric.hxx>
+#include <fontinstance.hxx>
+#include <fontselect.hxx>
#include <impfontmetric.hxx>
#include <impfontmetricdata.hxx>
#include <PhysicalFontFace.hxx>
@@ -224,10 +226,10 @@ ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
, mnDStrikeoutOffset2( 0 )
{
// initialize the used font name
- if( rFontSelData.mpFontData )
+ if (rFontSelData.mpFontInstance)
{
- SetFamilyName( rFontSelData.mpFontData->GetFamilyName() );
- SetStyleName( rFontSelData.mpFontData->GetStyleName() );
+ SetFamilyName(rFontSelData.mpFontInstance->GetFontFace()->GetFamilyName());
+ SetStyleName(rFontSelData.mpFontInstance->GetFontFace()->GetStyleName());
}
else
{
diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx
index 8e62cf080808..fd67335eb1cd 100644
--- a/vcl/source/font/fontselect.cxx
+++ b/vcl/source/font/fontselect.cxx
@@ -30,7 +30,6 @@ const char FontSelectPatternAttributes::FEAT_SEPARATOR = '&';
FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
const OUString& rSearchName, const Size& rSize, float fExactHeight)
: FontSelectPatternAttributes(rFont, rSearchName, rSize, fExactHeight)
- , mpFontData( nullptr )
, mpFontInstance( nullptr )
{
}
@@ -90,7 +89,6 @@ FontSelectPatternAttributes::FontSelectPatternAttributes( const PhysicalFontFace
FontSelectPattern::FontSelectPattern( const PhysicalFontFace& rFontData,
const Size& rSize, float fExactHeight, int nOrientation, bool bVertical )
: FontSelectPatternAttributes(rFontData, rSize, fExactHeight, nOrientation, bVertical)
- , mpFontData( &rFontData )
, mpFontInstance( nullptr )
{
}
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index ddb3986b277d..120993557634 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -187,8 +187,8 @@ void CommonSalLayout::ParseFeatures(const OUString& aName)
}
#if defined(_WIN32)
-CommonSalLayout::CommonSalLayout(HDC hDC, WinFontInstance& rWinFontInstance, const WinFontFace& rWinFontFace)
-: mrFontSelData(rWinFontInstance.maFontSelData)
+CommonSalLayout::CommonSalLayout(HDC hDC, WinFontInstance& rWinFontInstance)
+: mrFontSelData(rWinFontInstance.GetFontSelectPattern())
, mhDC(hDC)
, mhFont(static_cast<HFONT>(GetCurrentObject(hDC, OBJ_FONT)))
, mrWinFontInstance(rWinFontInstance)
@@ -196,6 +196,7 @@ CommonSalLayout::CommonSalLayout(HDC hDC, WinFontInstance& rWinFontInstance, con
, mpVertGlyphs(nullptr)
, mbFuzzing(utl::ConfigManager::IsFuzzing())
{
+ const WinFontFace& rWinFontFace = *static_cast<const WinFontFace*>(rWinFontInstance.GetFontFace());
mpHbFont = rWinFontFace.GetHbFont();
if (!mpHbFont)
{
@@ -239,7 +240,7 @@ bool CommonSalLayout::hasHScale() const
#elif defined(MACOSX) || defined(IOS)
CommonSalLayout::CommonSalLayout(const CoreTextStyle& rCoreTextStyle)
-: mrFontSelData(rCoreTextStyle.maFontSelData)
+: mrFontSelData(rCoreTextStyle.GetFontSelectPattern())
, mrCoreTextStyle(rCoreTextStyle)
, mpVertGlyphs(nullptr)
, mbFuzzing(utl::ConfigManager::IsFuzzing())
@@ -256,7 +257,7 @@ CommonSalLayout::CommonSalLayout(const CoreTextStyle& rCoreTextStyle)
if (pCGFont)
pHbFace = hb_coretext_face_create(pCGFont);
else
- pHbFace = hb_face_create_for_tables(getFontTable, const_cast<CoreTextFontFace*>(rCoreTextStyle.mpFontData), nullptr);
+ pHbFace = hb_face_create_for_tables(getFontTable, const_cast<PhysicalFontFace*>(rCoreTextStyle.GetFontFace()), nullptr);
CGFontRelease(pCGFont);
mpHbFont = createHbFont(pHbFace);
@@ -314,7 +315,7 @@ CommonSalLayout::CommonSalLayout(FreetypeFont& rFreetypeFont)
}
CommonSalLayout::CommonSalLayout(Qt5Font& rQFont)
- : CommonSalLayout(rQFont.GetFontSelData(),
+ : CommonSalLayout(rQFont.GetFontSelectPattern(),
nullptr, &rQFont, true)
{
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c10dbf1cb2f6..5ebdda50bace 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6219,7 +6219,7 @@ sal_Int32 PDFWriterImpl::getSystemFont( const vcl::Font& i_rFont )
getReferenceDevice()->SetFont( i_rFont );
getReferenceDevice()->ImplNewFont();
- const PhysicalFontFace* pDevFont = m_pReferenceDevice->mpFontInstance->maFontSelData.mpFontData;
+ const PhysicalFontFace* pDevFont = m_pReferenceDevice->mpFontInstance->GetFontFace();
sal_Int32 nFontID = 0;
FontEmbedData::iterator it = m_aSystemFonts.find( pDevFont );
if( it != m_aSystemFonts.end() )
@@ -6553,7 +6553,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
int nIndex = 0;
double fXScale = 1.0;
double fSkew = 0.0;
- sal_Int32 nPixelFontHeight = m_pReferenceDevice->mpFontInstance->maFontSelData.mnHeight;
+ sal_Int32 nPixelFontHeight = m_pReferenceDevice->mpFontInstance->GetFontSelectPattern().mnHeight;
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlignment();
// transform font height back to current units
@@ -6577,8 +6577,8 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
// perform artificial italics if necessary
if( ( m_aCurrentPDFState.m_aFont.GetItalic() == ITALIC_NORMAL ||
m_aCurrentPDFState.m_aFont.GetItalic() == ITALIC_OBLIQUE ) &&
- !( m_pReferenceDevice->mpFontInstance->maFontSelData.mpFontData->GetItalic() == ITALIC_NORMAL ||
- m_pReferenceDevice->mpFontInstance->maFontSelData.mpFontData->GetItalic() == ITALIC_OBLIQUE )
+ !( m_pReferenceDevice->mpFontInstance->GetFontFace()->GetItalic() == ITALIC_NORMAL ||
+ m_pReferenceDevice->mpFontInstance->GetFontFace()->GetItalic() == ITALIC_OBLIQUE )
)
{
fSkew = M_PI/12.0;
@@ -6605,8 +6605,8 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
bool bPop = false;
bool bABold = false;
// artificial bold necessary ?
- if( m_pReferenceDevice->mpFontInstance->maFontSelData.mpFontData->GetWeight() <= WEIGHT_MEDIUM &&
- m_pReferenceDevice->mpFontInstance->maFontSelData.GetWeight() > WEIGHT_MEDIUM )
+ if( m_pReferenceDevice->mpFontInstance->GetFontFace()->GetWeight() <= WEIGHT_MEDIUM &&
+ m_pReferenceDevice->mpFontInstance->GetFontSelectPattern().GetWeight() > WEIGHT_MEDIUM )
{
if( ! bPop )
aLine.append( "q " );
@@ -6667,7 +6667,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
FontMetric aRefDevFontMetric = m_pReferenceDevice->GetFontMetric();
- const PhysicalFontFace* pDevFont = m_pReferenceDevice->mpFontInstance->maFontSelData.mpFontData;
+ const PhysicalFontFace* pDevFont = m_pReferenceDevice->mpFontInstance->GetFontFace();
// collect the glyphs into a single array
std::vector< PDFGlyph > aGlyphs;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index f5780ea2680f..a5fe96a76db0 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1719,7 +1719,7 @@ void Printer::InitFont() const
if ( mbInitFont )
{
// select font in the device layers
- mpGraphics->SetFont( &(mpFontInstance->maFontSelData), 0 );
+ mpGraphics->SetFont(&mpFontInstance->GetFontSelectPattern(), 0);
mbInitFont = false;
}
}
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 25f3feec001f..c65dd0d5cce9 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -887,10 +887,8 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan
LogicalFontInstance* pFontInstance = pOutDev->mpFontCache->GetFontInstance( pOutDev->mpFontCollection, aFont, aSize, fExactHeight );
if (pFontInstance)
{
- if( pFontInstance->maFontSelData.mpFontData )
- aFont.SetFamilyName( pFontInstance->maFontSelData.mpFontData->GetFamilyName() );
- else
- aFont.SetFamilyName( pFontInstance->maFontSelData.maTargetName );
+ assert(pFontInstance->GetFontFace());
+ aFont.SetFamilyName(pFontInstance->GetFontFace()->GetFamilyName());
pFontInstance->Release();
}
}
@@ -977,16 +975,17 @@ void OutputDevice::InitFont() const
{
// decide if antialiasing is appropriate
bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
+ FontSelectPattern aPattern(mpFontInstance->GetFontSelectPattern());
if (!utl::ConfigManager::IsFuzzing())
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
- bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontInstance->maFontSelData.mnHeight);
+ bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > aPattern.mnHeight);
}
- mpFontInstance->maFontSelData.mbNonAntialiased = bNonAntialiased;
+ aPattern.mbNonAntialiased = bNonAntialiased;
// select font in the device layers
- mpGraphics->SetFont( &(mpFontInstance->maFontSelData), 0 );
+ mpGraphics->SetFont(&aPattern, 0);
mbInitFont = false;
}
}
@@ -1063,7 +1062,7 @@ bool OutputDevice::ImplNewFont() const
{
pFontInstance->mbInit = true;
- pFontInstance->mxFontMetric->SetOrientation( sal::static_int_cast<short>(pFontInstance->maFontSelData.mnOrientation) );
+ pFontInstance->mxFontMetric->SetOrientation( sal::static_int_cast<short>(mpFontInstance->GetFontSelectPattern().mnOrientation) );
pGraphics->GetFontMetric( pFontInstance->mxFontMetric, 0 );
pFontInstance->mxFontMetric->ImplInitTextLineSize( this );
@@ -1150,9 +1149,9 @@ bool OutputDevice::ImplNewFont() const
void OutputDevice::SetFontOrientation( LogicalFontInstance* const pFontInstance ) const
{
- if( pFontInstance->maFontSelData.mnOrientation && !pFontInstance->mxFontMetric->GetOrientation() )
+ if( pFontInstance->GetFontSelectPattern().mnOrientation && !pFontInstance->mxFontMetric->GetOrientation() )
{
- pFontInstance->mnOwnOrientation = sal::static_int_cast<short>(pFontInstance->maFontSelData.mnOrientation);
+ pFontInstance->mnOwnOrientation = sal::static_int_cast<short>(pFontInstance->GetFontSelectPattern().mnOrientation);
pFontInstance->mnOrientation = pFontInstance->mnOwnOrientation;
}
else
@@ -1341,7 +1340,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
rLayoutArgs.ResetPos();
OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear();
- FontSelectPattern aFontSelData = mpFontInstance->maFontSelData;
+ FontSelectPattern aFontSelData(mpFontInstance->GetFontSelectPattern());
// try if fallback fonts support the missing code units
for( int nFallbackLevel = 1; nFallbackLevel < MAX_FALLBACK; ++nFallbackLevel )
@@ -1357,13 +1356,12 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
break;
aFontSelData.mpFontInstance = pFallbackFont;
- aFontSelData.mpFontData = pFallbackFont->maFontSelData.mpFontData;
if( nFallbackLevel < MAX_FALLBACK-1)
{
// ignore fallback font if it is the same as the original font
// unless we are looking for a substitution for 0x202F, in which
// case we'll just use a normal space
- if( mpFontInstance->maFontSelData.mpFontData == aFontSelData.mpFontData &&
+ if( mpFontInstance->GetFontFace() == pFallbackFont->GetFontFace() &&
aMissingCodes.indexOf(0x202F) == -1 )
{
pFallbackFont->Release();
@@ -1379,7 +1377,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
if( !pMultiSalLayout )
pMultiSalLayout.reset( new MultiSalLayout( std::move(pSalLayout) ) );
pMultiSalLayout->AddFallback( std::move(pFallback),
- rLayoutArgs.maRuns, aFontSelData.mpFontData );
+ rLayoutArgs.maRuns, aFontSelData.mpFontInstance->GetFontFace() );
if (nFallbackLevel == MAX_FALLBACK-1)
pMultiSalLayout->SetIncomplete(true);
}
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index d794feb5ec42..1d115dc56397 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -217,9 +217,10 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
if( !pVDev->SetOutputSizePixel( aBoundRect.GetSize() ) )
return false;
+ const FontSelectPattern& rPattern = mpFontInstance->GetFontSelectPattern();
vcl::Font aFont( GetFont() );
aFont.SetOrientation( 0 );
- aFont.SetFontSize( Size( mpFontInstance->maFontSelData.mnWidth, mpFontInstance->maFontSelData.mnHeight ) );
+ aFont.SetFontSize( Size( rPattern.mnWidth, rPattern.mnHeight ) );
pVDev->SetFont( aFont );
pVDev->SetTextColor( COL_BLACK );
pVDev->SetTextFillColor();
@@ -1358,7 +1359,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr,
// do glyph fallback if needed
// #105768# avoid fallback for very small font sizes
- if (aLayoutArgs.NeedFallback() && mpFontInstance->maFontSelData.mnHeight >= 3)
+ if (aLayoutArgs.NeedFallback() && mpFontInstance->GetFontSelectPattern().mnHeight >= 3)
pSalLayout = ImplGlyphFallbackLayout(std::move(pSalLayout), aLayoutArgs);
// position, justify, etc. the layout
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c4db4c912977..879834c0da4c 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1756,7 +1756,7 @@ void Window::ImplNewInputContext()
pFontInstance = pFocusWin->mpFontCache->GetFontInstance( pFocusWin->mpFontCollection,
rFont, aSize, static_cast<float>(aSize.Height()) );
if ( pFontInstance )
- aNewContext.mpFont = &pFontInstance->maFontSelData;
+ aNewContext.mpFont = &pFontInstance->GetFontSelectPattern();
}
aNewContext.meLanguage = rFont.GetLanguage();
aNewContext.mnOptions = rInputContext.GetOptions();