diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-11 11:03:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-11 14:13:32 +0000 |
commit | 44cf768131e8a06ff688ddfa8b53f144ffb9e4a0 (patch) | |
tree | 4c9aa7008dc88b28ef038a78eb1e8779069819a6 /vcl/unx | |
parent | 42aeb8d9e163361c1b489916370eab7c2a3a391b (diff) |
adapt findFontFileID to know about multiple font faces in a font file
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/gdi/salgdi3.cxx | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx index 671e20ed1352..d492df229f52 100644 --- a/vcl/unx/generic/gdi/salgdi3.cxx +++ b/vcl/unx/generic/gdi/salgdi3.cxx @@ -537,24 +537,28 @@ bool X11SalGraphics::AddTempDevFont( ImplDevFontList* pFontList, rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); OString aOFileName( OUStringToOString( aUSystemPath, aEncoding ) ); psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - int nFontId = rMgr.addFontFile( aOFileName ); - if( !nFontId ) + std::vector<psp::fontID> aFontIds = rMgr.addFontFile( aOFileName ); + if( aFontIds.empty() ) return false; - // prepare font data - psp::FastPrintFontInfo aInfo; - rMgr.getFontFastInfo( nFontId, aInfo ); - aInfo.m_aFamilyName = rFontName; + GlyphCache& rGC = X11GlyphCache::GetInstance(); - // inform glyph cache of new font - ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo ); - aDFA.mnQuality += 5800; + for (std::vector<psp::fontID>::iterator aI = aFontIds.begin(), aEnd = aFontIds.end(); aI != aEnd; ++aI) + { + // prepare font data + psp::FastPrintFontInfo aInfo; + rMgr.getFontFastInfo( *aI, aInfo ); + aInfo.m_aFamilyName = rFontName; - int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID ); + // inform glyph cache of new font + ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo ); + aDFA.mnQuality += 5800; - GlyphCache& rGC = X11GlyphCache::GetInstance(); - const rtl::OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID ); - rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA ); + int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID ); + + const rtl::OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID ); + rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA ); + } // announce new font to device's font list rGC.AnnounceFonts( pFontList ); |