Fix text size measurement.

5.0 doesn't set the GAL's line width.  It gets away with this since
it's using the same GAL to measure as to set up the drawing, so
the width happens to be set correctly for other reasons.  5.1 uses
a separate GAL and so isn't so lucky.
This commit is contained in:
Jeff Young 2018-09-02 22:51:35 +01:00
parent b002b96db6
commit a67d8c60df
3 changed files with 7 additions and 5 deletions

View File

@ -64,10 +64,11 @@ void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
}
int EDA_TEXT::LenSize( const wxString& aLine ) const
int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const
{
basic_gal.SetFontItalic( IsItalic() );
basic_gal.SetFontBold( IsBold() );
basic_gal.SetLineWidth( aThickness );
basic_gal.SetGlyphSize( VECTOR2D( GetTextSize() ) );
VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );

View File

@ -1019,7 +1019,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
aPoints.clear();
int symb_len = LenSize( GetShownText() ) + ( TXT_MARGIN * 2 );
int symb_len = LenSize( GetShownText(), linewidth ) + ( TXT_MARGIN * 2 );
// Create outline shape : 6 points
int x = symb_len + linewidth + 3;
@ -1133,7 +1133,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN;
// text X size add height for triangular shapes(bidirectional)
length = LenSize( GetShownText() ) + height + DANGLING_SYMBOL_SIZE;
length = LenSize( GetShownText(), width ) + height + DANGLING_SYMBOL_SIZE;
switch( GetLabelSpinStyle() ) // respect orientation
{
@ -1313,7 +1313,7 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
int width = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
height = GetTextHeight() + width + 2 * TXT_MARGIN;
length = LenSize( GetShownText() )
length = LenSize( GetShownText(), width )
+ height // add height for triangular shapes
+ 2 * DANGLING_SYMBOL_SIZE;

View File

@ -305,8 +305,9 @@ public:
* @return the text length in internal units
* @param aLine : the line of text to consider.
* For single line text, this parameter is always m_Text
* @param aThickness : the stroke width of the text
*/
int LenSize( const wxString& aLine ) const;
int LenSize( const wxString& aLine, int aThickness ) const;
/**
* Function GetTextBox