summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/win/salgdi.h1
-rw-r--r--vcl/inc/win/winlayout.hxx16
-rw-r--r--vcl/win/gdi/salfont.cxx12
-rw-r--r--vcl/win/gdi/winlayout.cxx34
4 files changed, 10 insertions, 53 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index d974e7650805..f6faf4aa7631 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -376,7 +376,6 @@ public:
bool bVertical,
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- int GetMinKashidaWidth();
virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override;
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index d339df3847cb..ecd257467e5d 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -157,18 +157,6 @@ public:
private:
// TODO: also add HFONT??? Watch out for issues with too many active fonts...
-public:
- SCRIPT_CACHE& GetScriptCache() const
- { return maScriptCache; }
-private:
- mutable SCRIPT_CACHE maScriptCache;
-
-public:
- bool InitKashidaHandling( HDC );
- int GetMinKashidaWidth() const { return mnMinKashidaWidth; }
- int GetMinKashidaGlyph() const { return mnMinKashidaGlyph; }
-
-private:
GlyphCache maGlyphCache;
public:
bool CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, SalGraphics& rGraphics);
@@ -177,10 +165,6 @@ public:
{
return maGlyphCache;
}
-
-private:
- mutable int mnMinKashidaWidth;
- mutable int mnMinKashidaGlyph;
};
class TextOutRenderer
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index b8da03d9f0bf..9860d5f1392c 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -980,6 +980,16 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
const RawFontData aHheaRawData(getHDC(), nHheaTag);
const RawFontData aOS2RawData(getHDC(), nOS2Tag);
+ WCHAR nKashidaCh = 0x0640;
+ WORD nKashidaGid;
+ DWORD ret = GetGlyphIndicesW(getHDC(), &nKashidaCh, 1, &nKashidaGid, GGI_MARK_NONEXISTING_GLYPHS);
+ if (ret != GDI_ERROR && nKashidaGid != 0xFFFF)
+ {
+ int nKashidaWidth = 0;
+ if (GetCharWidthI(getHDC(), nKashidaGid, 1, nullptr, &nKashidaWidth))
+ rxFontMetric->SetMinKashida(nKashidaWidth);
+ }
+
// get the font metric
OUTLINETEXTMETRICW aOutlineMetric;
const bool bOK = GetOutlineTextMetricsW(getHDC(), sizeof(OUTLINETEXTMETRICW), &aOutlineMetric);
@@ -1004,8 +1014,6 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
const std::vector<uint8_t> rHhea(aHheaRawData.get(), aHheaRawData.get() + aHheaRawData.size());
const std::vector<uint8_t> rOS2(aOS2RawData.get(), aOS2RawData.get() + aOS2RawData.size());
rxFontMetric->ImplCalcLineSpacing(rHhea, rOS2, aOutlineMetric.otmEMSquare);
-
- rxFontMetric->SetMinKashida( GetMinKashidaWidth() );
}
const FontCharMapRef WinSalGraphics::GetFontCharMap() const
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 04724d89ad46..6436c618cda9 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -596,14 +596,6 @@ SalLayout* WinSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbac
return new CommonSalLayout(getHDC(), *mpWinFontEntry[nFallbackLevel], *mpWinFontData[nFallbackLevel]);
}
-int WinSalGraphics::GetMinKashidaWidth()
-{
- if( !mpWinFontEntry[0] )
- return 0;
- mpWinFontEntry[0]->InitKashidaHandling( getHDC() );
- return mpWinFontEntry[0]->GetMinKashidaWidth();
-}
-
LogicalFontInstance * WinSalGraphics::GetWinFontEntry(int const nFallbackLevel)
{
return mpWinFontEntry[nFallbackLevel];
@@ -611,37 +603,11 @@ LogicalFontInstance * WinSalGraphics::GetWinFontEntry(int const nFallbackLevel)
WinFontInstance::WinFontInstance( FontSelectPattern& rFSD )
: LogicalFontInstance( rFSD )
-, mnMinKashidaWidth( -1 )
-, mnMinKashidaGlyph( -1 )
{
- maScriptCache = nullptr;
}
WinFontInstance::~WinFontInstance()
{
- if( maScriptCache != nullptr )
- ScriptFreeCache( &maScriptCache );
-}
-
-bool WinFontInstance::InitKashidaHandling( HDC hDC )
-{
- if( mnMinKashidaWidth >= 0 ) // already cached?
- return mnMinKashidaWidth;
-
- // initialize the kashida width
- mnMinKashidaWidth = 0;
- mnMinKashidaGlyph = 0;
-
- SCRIPT_FONTPROPERTIES aFontProperties;
- aFontProperties.cBytes = sizeof (aFontProperties);
- SCRIPT_CACHE& rScriptCache = GetScriptCache();
- HRESULT nRC = ScriptGetFontProperties( hDC, &rScriptCache, &aFontProperties );
- if( nRC != 0 )
- return false;
- mnMinKashidaWidth = aFontProperties.iKashidaWidth;
- mnMinKashidaGlyph = aFontProperties.wgKashida;
-
- return true;
}
PhysicalFontFace* WinFontFace::Clone() const