Cairo GAL: fix incorrect size and thickness of text drawn by GAL::BitmapText()
This commit is contained in:
parent
6e35d5473e
commit
1d5be1adeb
|
@ -270,8 +270,9 @@ void GAL::BitmapText( const wxString& aText, const VECTOR2I& aPosition, const ED
|
|||
|
||||
// Bitmap font has different metrics than the stroke font so we compensate a bit before
|
||||
// stroking
|
||||
attrs.m_Size = VECTOR2I( m_attributes.m_Size.x * 1.62, m_attributes.m_Size.y * 1.39 );
|
||||
attrs.m_StrokeWidth = m_attributes.m_StrokeWidth * 0.8;
|
||||
attrs.m_Size = VECTOR2I( m_attributes.m_Size.x * 0.83, m_attributes.m_Size.y * 0.86 );
|
||||
int strokeWidth = GetLineWidth();
|
||||
attrs.m_StrokeWidth = strokeWidth * 0.8;
|
||||
|
||||
font->Draw( this, aText, aPosition, attrs );
|
||||
}
|
||||
|
|
|
@ -563,7 +563,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
|||
{
|
||||
VECTOR2I start( aTrack->GetStart() );
|
||||
VECTOR2I end( aTrack->GetEnd() );
|
||||
int width = aTrack->GetWidth();
|
||||
int track_width = aTrack->GetWidth();
|
||||
COLOR4D color = m_pcbSettings.GetColor( aTrack, aLayer );
|
||||
|
||||
if( IsNetnameLayer( aLayer ) )
|
||||
|
@ -588,11 +588,13 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
|||
ClipLine( &clipBox, visibleSeg.A.x, visibleSeg.A.y, visibleSeg.B.x, visibleSeg.B.y );
|
||||
|
||||
// Check if the track is long enough to have a netname displayed
|
||||
if( visibleSeg.Length() < 6 * width )
|
||||
int seg_minlenght = track_width * 6; // min lenght of the visible segment to draw the net name
|
||||
|
||||
if( visibleSeg.Length() < seg_minlenght )
|
||||
return;
|
||||
|
||||
const wxString& netName = UnescapeString( aTrack->GetShortNetname() );
|
||||
double textSize = width;
|
||||
double textSize = track_width;
|
||||
double penWidth = textSize / 12.0;
|
||||
VECTOR2D textPosition = ( visibleSeg.A + visibleSeg.B ) / 2.0; // center of the track
|
||||
EDA_ANGLE textOrientation;
|
||||
|
@ -600,7 +602,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
|||
// If the last position is still on the track, and it's some reasonable distance inside
|
||||
// the viewport then don't move the netname; just use the last position.
|
||||
if( visibleSeg.Distance( aTrack->m_LastNetnamePosition ) < penWidth
|
||||
&& clipBox.Inflate( -width * 6 ).Contains( aTrack->m_LastNetnamePosition ) )
|
||||
&& clipBox.Inflate( -seg_minlenght ).Contains( aTrack->m_LastNetnamePosition ) )
|
||||
{
|
||||
textPosition = aTrack->m_LastNetnamePosition;
|
||||
}
|
||||
|
@ -651,9 +653,9 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
|||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
width = width * 1.5;
|
||||
track_width = track_width * 1.5;
|
||||
|
||||
m_gal->DrawSegment( start, end, width );
|
||||
m_gal->DrawSegment( start, end, track_width );
|
||||
}
|
||||
|
||||
// Clearance lines
|
||||
|
@ -666,7 +668,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
|||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->DrawSegment( start, end, width + clearance * 2 );
|
||||
m_gal->DrawSegment( start, end, track_width + clearance * 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue