summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2021-09-12 14:41:19 +1000
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-05 18:11:01 +0200
commitc817a5a4958c323eb189e1374072998b8b13ba8c (patch)
tree0345dd9e4ae0b590a184b354e9fb183dbcd27f09 /vcl/win
parent0e736b0c20e096c5daf59f141b4509cfcc159a79 (diff)
vcl: test PhysicalFontFace and move to vcl::font namespace
- moved PhysicalFontFace.hxx to vcl/inc/font - added PhysicalFontFace to vcl::font namespace - had to regenerate precompiled_vcl.hxx - tested PhysicalFontFace, with some extensive tests for IsBetterMatch() Change-Id: I860022ac244f8a827f6f9cb7ed9018c5d9c328cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121970 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/salfont.cxx25
-rw-r--r--vcl/win/gdi/winlayout.cxx5
2 files changed, 16 insertions, 14 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 6dd8365e6955..842f5ed8830f 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -51,11 +51,12 @@
#include <vcl/fontcharmap.hxx>
#include <comphelper/scopeguard.hxx>
+#include <font/FontSelectPattern.hxx>
#include <fontsubset.hxx>
#include <outdev.h>
#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
#include <sft.hxx>
#include <win/saldata.hxx>
#include <win/salgdi.h>
@@ -180,13 +181,13 @@ public:
bool FindFontSubstitute(vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const override;
private:
HDC mhDC;
- bool HasMissingChars(PhysicalFontFace*, OUString& rMissingChars) const;
+ bool HasMissingChars(vcl::font::PhysicalFontFace*, OUString& rMissingChars) const;
};
}
// does a font face hold the given missing characters?
-bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, OUString& rMissingChars) const
+bool WinGlyphFallbackSubstititution::HasMissingChars(vcl::font::PhysicalFontFace* pFace, OUString& rMissingChars) const
{
WinFontFace* pWinFont = static_cast< WinFontFace* >(pFace);
FontCharMapRef xFontCharMap = pWinFont->GetFontCharMap();
@@ -303,7 +304,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat
vcl::font::PhysicalFontFamily* pFontFamily = findDevFontListByLocale(*pFontCollection, aLanguageTag);
if( pFontFamily )
{
- PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData );
+ vcl::font::PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData );
if( HasMissingChars( pFace, rMissingChars ) )
{
rFontSelData.maSearchName = pFontFamily->GetSearchName();
@@ -319,7 +320,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat
rFontSelData.maSearchName );
if( pFontFamily )
{
- PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData );
+ vcl::font::PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData );
if( HasMissingChars( pFace, rMissingChars ) )
{
rFontSelData.maSearchName = pFontFamily->GetSearchName();
@@ -338,7 +339,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat
bool bFound = false;
for( int i = 0; i < nTestFontCount; ++i )
{
- PhysicalFontFace* pFace = pTestFontList->Get( i );
+ vcl::font::PhysicalFontFace* pFace = pTestFontList->Get( i );
bFound = HasMissingChars( pFace, rMissingChars );
if( !bFound )
continue;
@@ -626,7 +627,7 @@ void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& rLogFont, Font& rFont )
WinFontFace::WinFontFace( const FontAttributes& rDFS,
BYTE eWinCharSet, BYTE nPitchAndFamily )
-: PhysicalFontFace( rDFS ),
+: vcl::font::PhysicalFontFace( rDFS ),
mnId( 0 ),
mbFontCapabilitiesRead( false ),
meWinCharSet( eWinCharSet ),
@@ -762,7 +763,7 @@ void WinSalGraphics::SetTextColor( Color nColor )
}
void ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern& rFont,
- const PhysicalFontFace* pFontFace,
+ const vcl::font::PhysicalFontFace* pFontFace,
LOGFONTW& rLogFont )
{
OUString aName;
@@ -811,7 +812,7 @@ void ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern& rFont,
}
HFONT WinSalGraphics::ImplDoSetFont(vcl::font::FontSelectPattern const & i_rFont,
- const PhysicalFontFace * i_pFontFace,
+ const vcl::font::PhysicalFontFace * i_pFontFace,
HFONT& o_rOldFont)
{
HFONT hNewFont = nullptr;
@@ -1535,7 +1536,7 @@ SFErrCodes ScopedTrueTypeFont::open(void const * pBuffer, sal_uInt32 nLen,
}
bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
- const PhysicalFontFace* pFont, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
+ const vcl::font::PhysicalFontFace* pFont, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo )
{
// TODO: use more of the central font-subsetting code, move stuff there if needed
@@ -1604,7 +1605,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
pEncoding, pGlyphWidths, nGlyphCount);
}
-const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, tools::Long* pDataLen)
+const void* WinSalGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen)
{
// create matching FontSelectPattern
// we need just enough to get to the font file data
@@ -1630,7 +1631,7 @@ void WinSalGraphics::FreeEmbedFontData( const void* pData, tools::Long /*nLen*/
delete[] static_cast<char const *>(pData);
}
-void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
+void WinSalGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* pFont,
bool bVertical,
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc )
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 749b9c96ec4f..0db736c256c0 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -163,7 +163,7 @@ struct BlobReference
};
}
-using BlobCacheKey = std::pair<rtl::Reference<PhysicalFontFace>, hb_tag_t>;
+using BlobCacheKey = std::pair<rtl::Reference<vcl::font::PhysicalFontFace>, hb_tag_t>;
namespace
{
@@ -189,7 +189,8 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
assert(hDC);
assert(hFont);
- BlobCacheKey cacheKey{ rtl::Reference<PhysicalFontFace>(pFont->GetFontFace()), nTableTag };
+ BlobCacheKey cacheKey{ rtl::Reference<vcl::font::PhysicalFontFace>(pFont->GetFontFace()),
+ nTableTag };
auto it = gCache.find(cacheKey);
if (it != gCache.end())
{