Kaydet (Commit) daf16b78 authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Andras Timar

SimpleWinLayout::mbDisableGlyphs was always true

Remove dead code. Should have no effect on behaviour.

Possibly originally the intent was that mbDisableGlyphs would have
been false in most cases on NT-based Windows (all versions that we
support now). However, since dadfc608,
in 2005, mbDisableGlyphs was set to always true in the SimpleWinLayout
ctor.

Change-Id: Id929224d5656706762c2f44ee26c76f8b20ee8b8
Signed-off-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst e44c4ed2
...@@ -87,7 +87,6 @@ public: ...@@ -87,7 +87,6 @@ public:
BYTE GetCharSet() const { return meWinCharSet; } BYTE GetCharSet() const { return meWinCharSet; }
BYTE GetPitchAndFamily() const { return mnPitchAndFamily; } BYTE GetPitchAndFamily() const { return mnPitchAndFamily; }
bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; }
bool SupportsKorean() const { return mbHasKoreanRange; } bool SupportsKorean() const { return mbHasKoreanRange; }
bool SupportsCJK() const { return mbHasCJKSupport; } bool SupportsCJK() const { return mbHasCJKSupport; }
bool SupportsArabic() const { return mbHasArabicSupport; } bool SupportsArabic() const { return mbHasArabicSupport; }
...@@ -111,7 +110,6 @@ private: ...@@ -111,7 +110,6 @@ private:
sal_IntPtr mnId; sal_IntPtr mnId;
// some members that are initalized lazily when the font gets selected into a HDC // some members that are initalized lazily when the font gets selected into a HDC
mutable bool mbDisableGlyphApi;
mutable bool mbHasKoreanRange; mutable bool mbHasKoreanRange;
mutable bool mbHasCJKSupport; mutable bool mbHasCJKSupport;
#if ENABLE_GRAPHITE #if ENABLE_GRAPHITE
......
...@@ -1086,7 +1086,6 @@ ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS, ...@@ -1086,7 +1086,6 @@ ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS,
int nHeight, BYTE eWinCharSet, BYTE nPitchAndFamily ) int nHeight, BYTE eWinCharSet, BYTE nPitchAndFamily )
: PhysicalFontFace( rDFS, 0 ), : PhysicalFontFace( rDFS, 0 ),
mnId( 0 ), mnId( 0 ),
mbDisableGlyphApi( false ),
mbHasKoreanRange( false ), mbHasKoreanRange( false ),
mbHasCJKSupport( false ), mbHasCJKSupport( false ),
#if ENABLE_GRAPHITE #if ENABLE_GRAPHITE
...@@ -1186,15 +1185,6 @@ void ImplWinFontData::UpdateFromHDC( HDC hDC ) const ...@@ -1186,15 +1185,6 @@ void ImplWinFontData::UpdateFromHDC( HDC hDC ) const
} }
} }
#endif #endif
// even if the font works some fonts have problems with the glyph API
// => the heuristic below tries to figure out which fonts have the problem
TEXTMETRICA aTextMetric;
if( ::GetTextMetricsA( hDC, &aTextMetric ) )
if( !(aTextMetric.tmPitchAndFamily & TMPF_TRUETYPE)
|| (aTextMetric.tmPitchAndFamily & TMPF_DEVICE) )
mbDisableGlyphApi = true;
} }
#if ENABLE_GRAPHITE #if ENABLE_GRAPHITE
...@@ -1291,7 +1281,6 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const ...@@ -1291,7 +1281,6 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const
if( aRawFontData.get() ) { if( aRawFontData.get() ) {
CmapResult aResult; CmapResult aResult;
ParseCMAP( aRawFontData.get(), aRawFontData.size(), aResult ); ParseCMAP( aRawFontData.get(), aRawFontData.size(), aResult );
mbDisableGlyphApi |= aResult.mbRecoded;
aResult.mbSymbolic = bIsSymbolFont; aResult.mbSymbolic = bIsSymbolFont;
if( aResult.mnRangeCount > 0 ) if( aResult.mnRangeCount > 0 )
{ {
......
...@@ -241,11 +241,9 @@ SimpleWinLayout::SimpleWinLayout(HDC hDC, BYTE nCharSet, const ImplWinFontData& ...@@ -241,11 +241,9 @@ SimpleWinLayout::SimpleWinLayout(HDC hDC, BYTE nCharSet, const ImplWinFontData&
mpGlyphs2Chars( NULL ), mpGlyphs2Chars( NULL ),
mpGlyphRTLFlags( NULL ), mpGlyphRTLFlags( NULL ),
mnWidth( 0 ), mnWidth( 0 ),
mbDisableGlyphs( false ),
mnNotdefWidth( -1 ), mnNotdefWidth( -1 ),
mnCharSet( nCharSet ) mnCharSet( nCharSet )
{ {
mbDisableGlyphs = true;
} }
SimpleWinLayout::~SimpleWinLayout() SimpleWinLayout::~SimpleWinLayout()
...@@ -264,20 +262,8 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) ...@@ -264,20 +262,8 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
{ {
// prepare layout // prepare layout
// TODO: fix case when recyclying old SimpleWinLayout object // TODO: fix case when recyclying old SimpleWinLayout object
mbDisableGlyphs |= bool(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing);
mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos; mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
if( !mbDisableGlyphs )
{
// Win32 glyph APIs have serious problems with vertical layout
// => workaround is to use the unicode methods then
if( rArgs.mnFlags & SalLayoutFlags::Vertical )
mbDisableGlyphs = true;
else
// use cached value from font face
mbDisableGlyphs = mrWinFontData.IsGlyphApiDisabled();
}
// TODO: use a cached value for bDisableAsianKern from upper layers // TODO: use a cached value for bDisableAsianKern from upper layers
if( rArgs.mnFlags & SalLayoutFlags::KerningAsian ) if( rArgs.mnFlags & SalLayoutFlags::KerningAsian )
{ {
...@@ -435,9 +421,6 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) ...@@ -435,9 +421,6 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
if( GetTextExtentPoint32W( mhDC, &cNotDef, 1, &aExtent) ) if( GetTextExtentPoint32W( mhDC, &cNotDef, 1, &aExtent) )
mnNotdefWidth = aExtent.cx; mnNotdefWidth = aExtent.cx;
} }
// use a better NotDef glyph
if( !mbDisableGlyphs && !bSurrogate )
mpOutGlyphs[i] = 0;
} }
if( bSurrogate && ((i+1) < mnGlyphCount) ) if( bSurrogate && ((i+1) < mnGlyphCount) )
mpOutGlyphs[i+1] = DROPPED_OUTGLYPH; mpOutGlyphs[i+1] = DROPPED_OUTGLYPH;
...@@ -545,23 +528,21 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPo ...@@ -545,23 +528,21 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPo
{ {
// update return values {aGlyphId,nCharPos,nGlyphAdvance} // update return values {aGlyphId,nCharPos,nGlyphAdvance}
sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ]; sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ];
if( mbDisableGlyphs ) if( mnLayoutFlags & SalLayoutFlags::Vertical )
{ {
if( mnLayoutFlags & SalLayoutFlags::Vertical ) const sal_UCS4 cChar = static_cast<sal_UCS4>(aGlyphId & GF_IDXMASK);
if( mrWinFontData.HasGSUBstitutions( mhDC )
&& mrWinFontData.IsGSUBstituted( cChar ) )
aGlyphId |= GF_GSUB | GF_ROTL;
else
{ {
const sal_UCS4 cChar = static_cast<sal_UCS4>(aGlyphId & GF_IDXMASK); aGlyphId |= GetVerticalFlags( cChar );
if( mrWinFontData.HasGSUBstitutions( mhDC ) if( (aGlyphId & GF_ROTMASK) == 0 )
&& mrWinFontData.IsGSUBstituted( cChar ) ) aGlyphId |= GF_VERT;
aGlyphId |= GF_GSUB | GF_ROTL;
else
{
aGlyphId |= GetVerticalFlags( cChar );
if( (aGlyphId & GF_ROTMASK) == 0 )
aGlyphId |= GF_VERT;
}
} }
aGlyphId |= GF_ISCHAR;
} }
aGlyphId |= GF_ISCHAR;
++nCount; ++nCount;
*(pGlyphIds++) = aGlyphId; *(pGlyphIds++) = aGlyphId;
if( pGlyphAdvances ) if( pGlyphAdvances )
...@@ -595,11 +576,6 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const ...@@ -595,11 +576,6 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const
return; return;
HFONT hOrigFont = DisableFontScaling(); HFONT hOrigFont = DisableFontScaling();
UINT mnDrawOptions = ETO_GLYPH_INDEX;
if( mbDisableGlyphs )
mnDrawOptions = 0;
Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) ); Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) );
// #108267#, break up into glyph portions of a limited size required by Win32 API // #108267#, break up into glyph portions of a limited size required by Win32 API
...@@ -618,14 +594,14 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const ...@@ -618,14 +594,14 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const
unsigned int i = 0; unsigned int i = 0;
for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount ) for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount )
{ {
ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i); ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
} }
ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i); ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL); MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
SetTextAlign(hDC, oldTa); SetTextAlign(hDC, oldTa);
} }
else else
ExtTextOutW(hDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances); ExtTextOutW(hDC, aPos.X(), aPos.Y(), 0, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
if( hOrigFont ) if( hOrigFont )
DeleteFont(SelectFont(hDC, hOrigFont)); DeleteFont(SelectFont(hDC, hOrigFont));
......
...@@ -103,7 +103,6 @@ private: ...@@ -103,7 +103,6 @@ private:
int* mpGlyphs2Chars; // map abs glyph pos to abs char pos int* mpGlyphs2Chars; // map abs glyph pos to abs char pos
bool* mpGlyphRTLFlags; // BiDi status for glyphs: true=>RTL bool* mpGlyphRTLFlags; // BiDi status for glyphs: true=>RTL
mutable long mnWidth; mutable long mnWidth;
bool mbDisableGlyphs;
int mnNotdefWidth; int mnNotdefWidth;
BYTE mnCharSet; BYTE mnCharSet;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment