fixing gdiplus implementation, see #11282
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62321 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1454,23 +1454,37 @@ void wxGDIPlusContext::GetPartialTextExtents(const wxString& text, wxArrayDouble
|
|||||||
RectF layoutRect(0,0, 100000.0f, 100000.0f);
|
RectF layoutRect(0,0, 100000.0f, 100000.0f);
|
||||||
StringFormat strFormat( StringFormat::GenericTypographic() );
|
StringFormat strFormat( StringFormat::GenericTypographic() );
|
||||||
|
|
||||||
CharacterRange* ranges = new CharacterRange[len] ;
|
size_t startPosition = 0;
|
||||||
Region* regions = new Region[len];
|
size_t reminder = len;
|
||||||
for( size_t i = 0 ; i < len ; ++i)
|
const size_t maxSpan = 32;
|
||||||
{
|
CharacterRange* ranges = new CharacterRange[maxSpan] ;
|
||||||
ranges[i].First = i ;
|
Region* regions = new Region[maxSpan];
|
||||||
ranges[i].Length = 1 ;
|
|
||||||
}
|
|
||||||
strFormat.SetMeasurableCharacterRanges(len,ranges);
|
|
||||||
strFormat.SetFormatFlags( StringFormatFlagsMeasureTrailingSpaces | strFormat.GetFormatFlags() );
|
|
||||||
m_context->MeasureCharacterRanges(ws, -1 , f,layoutRect, &strFormat,1,regions) ;
|
|
||||||
|
|
||||||
RectF bbox ;
|
while( reminder > 0 )
|
||||||
for ( size_t i = 0 ; i < len ; ++i)
|
|
||||||
{
|
{
|
||||||
regions[i].GetBounds(&bbox,m_context);
|
size_t span = wxMin( maxSpan, reminder );
|
||||||
widths[i] = bbox.GetRight()-bbox.GetLeft();
|
|
||||||
|
for( size_t i = 0 ; i < span ; ++i)
|
||||||
|
{
|
||||||
|
ranges[i].First = 0 ;
|
||||||
|
ranges[i].Length = startPosition+i+1 ;
|
||||||
|
}
|
||||||
|
strFormat.SetMeasurableCharacterRanges(span,ranges);
|
||||||
|
strFormat.SetFormatFlags( StringFormatFlagsMeasureTrailingSpaces | strFormat.GetFormatFlags() );
|
||||||
|
m_context->MeasureCharacterRanges(ws, -1 , f,layoutRect, &strFormat,span,regions) ;
|
||||||
|
|
||||||
|
RectF bbox ;
|
||||||
|
for ( size_t i = 0 ; i < span ; ++i)
|
||||||
|
{
|
||||||
|
regions[i].GetBounds(&bbox,m_context);
|
||||||
|
widths[startPosition+i] = bbox.Width;
|
||||||
|
}
|
||||||
|
reminder -= span;
|
||||||
|
startPosition += span;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] ranges;
|
||||||
|
delete[] regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGDIPlusContext::ShouldOffset() const
|
bool wxGDIPlusContext::ShouldOffset() const
|
||||||
|
Reference in New Issue
Block a user