Browse Source

Adjust bitmap text spacing a bit so it's closer to the stroke font.

This helps the text better match the highlighting when it gets small
enough that we switch to the bitmap font for performance.
7.0
Jeff Young 4 years ago
parent
commit
bf0f2aa4a8
  1. 8
      common/gal/graphics_abstraction_layer.cpp
  2. 7
      eeschema/sch_painter.cpp
  3. 12
      pcbnew/pcb_painter.cpp

8
common/gal/graphics_abstraction_layer.cpp

@ -268,10 +268,10 @@ void GAL::BitmapText( const wxString& aText, const VECTOR2I& aPosition, const ED
attrs.m_Angle = aAngle;
attrs.m_Mirrored = m_globalFlipX; // Prevent text flipping when view is flipped
// Bitmap font is slightly smaller and slightly heavier than the stroke font so we
// compensate a bit before stroking
attrs.m_StrokeWidth *= 1.2f;
attrs.m_Size = attrs.m_Size * 0.8;
// 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;
font->Draw( this, aText, aPosition, attrs );
}

7
eeschema/sch_painter.cpp

@ -508,9 +508,10 @@ void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition,
void SCH_PAINTER::bitmapText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttrs )
{
m_gal->SetGlyphSize( aAttrs.m_Size );
m_gal->SetLineWidth( aAttrs.m_StrokeWidth );
// Bitmap font has different metrics than the stroke font so we compensate a bit before
// stroking
m_gal->SetGlyphSize( VECTOR2I( aAttrs.m_Size.x * 0.60, aAttrs.m_Size.y * 0.72 ) );
m_gal->SetLineWidth( aAttrs.m_StrokeWidth * 1.2 );
m_gal->SetHorizontalJustify( aAttrs.m_Halign );
m_gal->SetVerticalJustify( aAttrs.m_Valign );

12
pcbnew/pcb_painter.cpp

@ -590,7 +590,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
const wxString& netName = UnescapeString( aTrack->GetShortNetname() );
double textSize = width;
double penWidth = width / 12.0;
double penWidth = textSize / 12.0;
VECTOR2D textPosition = ( visibleSeg.A + visibleSeg.B ) / 2.0; // center of the track
EDA_ANGLE textOrientation;
@ -609,19 +609,15 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
if( end.y == start.y ) // horizontal
{
textOrientation = ANGLE_HORIZONTAL;
textPosition.y += penWidth;
}
else if( end.x == start.x ) // vertical
{
textOrientation = ANGLE_VERTICAL;
textPosition.x += penWidth;
}
else
{
textOrientation = EDA_ANGLE( visibleSeg.B - visibleSeg.A ) + ANGLE_90;
textOrientation.Normalize90();
textPosition.x += penWidth / 1.4;
textPosition.y += penWidth / 1.4;
}
m_gal->SetIsStroke( true );
@ -789,7 +785,7 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
tsize = std::min( tsize, size );
// Use a smaller text size to handle interline, pen size..
tsize *= 0.7;
tsize *= 0.75;
VECTOR2D namesize( tsize, tsize );
m_gal->SetGlyphSize( namesize );
@ -985,7 +981,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
tsize = std::min( tsize, size );
// Use a smaller text size to handle interline, pen size...
tsize *= 0.7;
tsize *= 0.75;
VECTOR2D namesize( tsize, tsize );
m_gal->SetGlyphSize( namesize );
@ -1002,7 +998,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
tsize = std::min( tsize, size );
// Use a smaller text size to handle interline, pen size...
tsize *= 0.7;
tsize *= 0.75;
tsize = std::min( tsize, size );
VECTOR2D numsize( tsize, tsize );

Loading…
Cancel
Save