Clean up pin text plotting code and update print code to match.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15501
This commit is contained in:
parent
17775e5377
commit
1eaadf7c7f
|
@ -381,20 +381,17 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
|
||||||
if( !aDrawPinName && !aDrawPinNum )
|
if( !aDrawPinName && !aDrawPinNum )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x, y;
|
|
||||||
wxDC* DC = aSettings->GetPrintDC();
|
|
||||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
|
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
|
||||||
|
wxString name = GetShownName();
|
||||||
VECTOR2I pinNameSize( m_nameTextSize, m_nameTextSize );
|
wxString number = GetShownNumber();
|
||||||
VECTOR2I pinNumSize( m_numTextSize, m_numTextSize );
|
VECTOR2I nameSize( m_nameTextSize, m_nameTextSize );
|
||||||
|
VECTOR2I numSize( m_numTextSize, m_numTextSize );
|
||||||
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
|
int nameWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
|
||||||
aSettings->GetDefaultPenWidth() );
|
aSettings->GetDefaultPenWidth() );
|
||||||
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
|
int numWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
|
||||||
aSettings->GetDefaultPenWidth() );
|
aSettings->GetDefaultPenWidth() );
|
||||||
|
int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + nameWidth;
|
||||||
int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
|
int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numWidth;
|
||||||
int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
|
|
||||||
|
|
||||||
/* Get the num and name colors */
|
/* Get the num and name colors */
|
||||||
COLOR4D nameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
|
COLOR4D nameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
|
||||||
|
@ -426,15 +423,28 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
|
||||||
case PIN_ORIENTATION::PIN_RIGHT: x1 += m_length; break;
|
case PIN_ORIENTATION::PIN_RIGHT: x1 += m_length; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name = GetShownName();
|
|
||||||
wxString number = GetShownNumber();
|
|
||||||
|
|
||||||
if( name.IsEmpty() || m_nameTextSize == 0 )
|
if( name.IsEmpty() || m_nameTextSize == 0 )
|
||||||
aDrawPinName = false;
|
aDrawPinName = false;
|
||||||
|
|
||||||
if( number.IsEmpty() || m_numTextSize == 0 )
|
if( number.IsEmpty() || m_numTextSize == 0 )
|
||||||
aDrawPinNum = false;
|
aDrawPinNum = false;
|
||||||
|
|
||||||
|
auto printName =
|
||||||
|
[&]( int x, int y, const EDA_ANGLE& angle, enum GR_TEXT_H_ALIGN_T hAlign,
|
||||||
|
enum GR_TEXT_V_ALIGN_T vAlign )
|
||||||
|
{
|
||||||
|
GRPrintText( aSettings->GetPrintDC(), VECTOR2I( x, y ), nameColor, name, angle,
|
||||||
|
nameSize, hAlign, vAlign, nameWidth, false, false, font, GetFontMetrics() );
|
||||||
|
};
|
||||||
|
|
||||||
|
auto printNum =
|
||||||
|
[&]( int x, int y, const EDA_ANGLE& angle, enum GR_TEXT_H_ALIGN_T hAlign,
|
||||||
|
enum GR_TEXT_V_ALIGN_T vAlign )
|
||||||
|
{
|
||||||
|
GRPrintText( aSettings->GetPrintDC(), VECTOR2I( x, y ), numColor, number, angle,
|
||||||
|
numSize, hAlign, vAlign, numWidth, false, false, font, GetFontMetrics() );
|
||||||
|
};
|
||||||
|
|
||||||
if( aTextInside ) // Draw the text inside, but the pin numbers outside.
|
if( aTextInside ) // Draw the text inside, but the pin numbers outside.
|
||||||
{
|
{
|
||||||
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|
||||||
|
@ -445,26 +455,20 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
|
||||||
{
|
{
|
||||||
if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
|
if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
|
||||||
{
|
{
|
||||||
x = x1 + aTextInside;
|
printName( x1 + aTextInside, y1, ANGLE_HORIZONTAL,
|
||||||
GRPrintText( DC, VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL,
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER,
|
|
||||||
namePenWidth, false, false, font, GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
else // Orient == PIN_LEFT
|
else // Orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
x = x1 - aTextInside;
|
printName( x1 - aTextInside, y1, ANGLE_HORIZONTAL,
|
||||||
GRPrintText( DC, VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL,
|
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER,
|
|
||||||
namePenWidth, false, false, font, GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRPrintText( DC, VECTOR2I(( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
|
printNum( ( x1 + aPinPos.x ) / 2, y1 - num_offset, ANGLE_HORIZONTAL,
|
||||||
number, ANGLE_HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font,
|
|
||||||
GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -472,40 +476,30 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
|
||||||
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
|
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
|
||||||
if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
|
if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
|
||||||
{
|
{
|
||||||
y = y1 + aTextInside;
|
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
GRPrintText( DC, VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
|
printName( x1, y1 + aTextInside, ANGLE_VERTICAL,
|
||||||
pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
namePenWidth, false, false, font, GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
printNum( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font,
|
|
||||||
GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* PIN_UP */
|
else /* PIN_UP */
|
||||||
{
|
{
|
||||||
y = y1 - aTextInside;
|
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
GRPrintText( DC, VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
|
printName( x1, y1 - aTextInside, ANGLE_VERTICAL,
|
||||||
pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
namePenWidth, false, false, font, GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
printNum( x1 - num_offset, ( y1 + aPinPos.y) / 2, ANGLE_VERTICAL,
|
||||||
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font,
|
|
||||||
GetFontMetrics() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,36 +510,44 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
|
||||||
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
|
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
|
||||||
{
|
{
|
||||||
/* Its an horizontal line. */
|
/* Its an horizontal line. */
|
||||||
if( aDrawPinName )
|
if( aDrawPinName && aDrawPinNum )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x ) / 2;
|
printName( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||||
GRPrintText( DC, VECTOR2I( x, y1 - name_offset ), nameColor, name, ANGLE_HORIZONTAL,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
|
||||||
namePenWidth, false, false, font, GetFontMetrics() );
|
printNum( ( x1 + aPinPos.x ) / 2, y1 + num_offset, ANGLE_HORIZONTAL,
|
||||||
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP );
|
||||||
}
|
}
|
||||||
if( aDrawPinNum )
|
else if( aDrawPinName )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x ) / 2;
|
printName( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||||
GRPrintText( DC, VECTOR2I( x, y1 + num_offset ), numColor, number, ANGLE_HORIZONTAL,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP,
|
}
|
||||||
numPenWidth, false, false, font, GetFontMetrics() );
|
else if( aDrawPinNum )
|
||||||
|
{
|
||||||
|
printNum( ( x1 + aPinPos.x ) / 2, y1 - num_offset, ANGLE_HORIZONTAL,
|
||||||
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
{
|
{
|
||||||
if( aDrawPinName )
|
if( aDrawPinName && aDrawPinNum )
|
||||||
{
|
{
|
||||||
y = ( y1 + aPinPos.y) / 2;
|
printName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
GRPrintText( DC, VECTOR2I( x1 - name_offset, y ), nameColor, name, ANGLE_VERTICAL,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
|
||||||
namePenWidth, false, false, font, GetFontMetrics() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( aDrawPinNum )
|
printNum( x1 + num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP );
|
||||||
|
}
|
||||||
|
else if( aDrawPinName )
|
||||||
{
|
{
|
||||||
GRPrintText( DC, VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
printName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false, font, GetFontMetrics() );
|
}
|
||||||
|
else if( aDrawPinNum )
|
||||||
|
{
|
||||||
|
printNum( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,7 +783,6 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
|
||||||
if( !aDrawPinNum && !aDrawPinName )
|
if( !aDrawPinNum && !aDrawPinName )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x, y;
|
|
||||||
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
|
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
|
||||||
settings->GetDefaultPenWidth() );
|
settings->GetDefaultPenWidth() );
|
||||||
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
|
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
|
||||||
|
@ -832,6 +833,24 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
|
||||||
aPlotter->PlotText( VECTOR2I( px, py ), color, text, attrs, font, GetFontMetrics() );
|
aPlotter->PlotText( VECTOR2I( px, py ), color, text, attrs, font, GetFontMetrics() );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto plotName =
|
||||||
|
[&]( int px, int py, const EDA_ANGLE& angle, GR_TEXT_H_ALIGN_T hJustify,
|
||||||
|
GR_TEXT_V_ALIGN_T vJustify )
|
||||||
|
|
||||||
|
{
|
||||||
|
plotText( px, py, nameColor, name, angle, m_nameTextSize, hJustify, vJustify,
|
||||||
|
namePenWidth );
|
||||||
|
};
|
||||||
|
|
||||||
|
auto plotNum =
|
||||||
|
[&]( int px, int py, const EDA_ANGLE& angle, GR_TEXT_H_ALIGN_T hJustify,
|
||||||
|
GR_TEXT_V_ALIGN_T vJustify )
|
||||||
|
|
||||||
|
{
|
||||||
|
plotText( px, py, numColor, number, angle, m_numTextSize, hJustify, vJustify,
|
||||||
|
numPenWidth );
|
||||||
|
};
|
||||||
|
|
||||||
/* Draw the text inside, but the pin numbers outside. */
|
/* Draw the text inside, but the pin numbers outside. */
|
||||||
if( aTextInside )
|
if( aTextInside )
|
||||||
{
|
{
|
||||||
|
@ -840,64 +859,52 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
|
||||||
{
|
{
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
GR_TEXT_H_ALIGN_T hjustify;
|
|
||||||
|
|
||||||
if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
|
if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
|
||||||
{
|
{
|
||||||
x = x1 + aTextInside;
|
plotName( x1 + aTextInside, y1, ANGLE_HORIZONTAL,
|
||||||
hjustify = GR_TEXT_H_ALIGN_LEFT;
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
}
|
}
|
||||||
else // orient == PIN_LEFT
|
else // orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
x = x1 - aTextInside;
|
plotName( x1 - aTextInside, y1, ANGLE_HORIZONTAL,
|
||||||
hjustify = GR_TEXT_H_ALIGN_RIGHT;
|
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
plotText( x, y1, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize, hjustify,
|
|
||||||
GR_TEXT_V_ALIGN_CENTER, namePenWidth );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( ( x1 + aPinPos.x) / 2, y1 - num_offset, numColor, number,
|
plotNum( ( x1 + aPinPos.x) / 2, y1 - num_offset, ANGLE_HORIZONTAL,
|
||||||
ANGLE_HORIZONTAL, m_numTextSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
{
|
{
|
||||||
if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
|
if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
|
||||||
{
|
{
|
||||||
y = y1 + aTextInside;
|
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
plotText( x1, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
plotName( x1, y1 + aTextInside, ANGLE_VERTICAL,
|
||||||
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth );
|
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( x1 - num_offset, ( y1 + aPinPos.y) / 2, numColor, number,
|
plotNum( x1 - num_offset, ( y1 + aPinPos.y) / 2, ANGLE_VERTICAL,
|
||||||
ANGLE_VERTICAL, m_numTextSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* PIN_UP */
|
else /* PIN_UP */
|
||||||
{
|
{
|
||||||
y = y1 - aTextInside;
|
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
plotText( x1, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
plotName( x1, y1 - aTextInside, ANGLE_VERTICAL,
|
||||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth );
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( x1 - num_offset, ( y1 + aPinPos.y) / 2, numColor, number,
|
plotNum( x1 - num_offset, ( y1 + aPinPos.y) / 2, ANGLE_VERTICAL,
|
||||||
ANGLE_VERTICAL, m_numTextSize, GR_TEXT_H_ALIGN_CENTER,
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -908,49 +915,45 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
|
||||||
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
|
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
|
||||||
{
|
{
|
||||||
/* Its an horizontal line. */
|
/* Its an horizontal line. */
|
||||||
x = ( x1 + aPinPos.x) / 2;
|
|
||||||
|
|
||||||
if( aDrawPinName && aDrawPinNum )
|
if( aDrawPinName && aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( x, y1 - name_offset, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize,
|
plotName( ( x1 + aPinPos.x) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
|
|
||||||
plotText( x, y1 + num_offset, numColor, number, ANGLE_HORIZONTAL, m_numTextSize,
|
plotNum( ( x1 + aPinPos.x) / 2, y1 + num_offset, ANGLE_HORIZONTAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP );
|
||||||
}
|
}
|
||||||
else if( aDrawPinName )
|
else if( aDrawPinName )
|
||||||
{
|
{
|
||||||
plotText( x, y1 - name_offset, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize,
|
plotName( ( x1 + aPinPos.x) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
}
|
}
|
||||||
else if( aDrawPinNum )
|
else if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( x, y1 - name_offset, numColor, number, ANGLE_HORIZONTAL, m_numTextSize,
|
plotNum( ( x1 + aPinPos.x) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Its a vertical line. */
|
/* Its a vertical line. */
|
||||||
y = ( y1 + aPinPos.y ) / 2;
|
|
||||||
|
|
||||||
if( aDrawPinName && aDrawPinNum )
|
if( aDrawPinName && aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( x1 - name_offset, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
plotName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
|
|
||||||
plotText( x1 + num_offset, y, numColor, number, ANGLE_VERTICAL, m_numTextSize,
|
plotNum( x1 + num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP );
|
||||||
}
|
}
|
||||||
else if( aDrawPinName )
|
else if( aDrawPinName )
|
||||||
{
|
{
|
||||||
plotText( x1 - name_offset, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
plotName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
}
|
}
|
||||||
else if( aDrawPinNum )
|
else if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
plotText( x1 - num_offset, y, numColor, number, ANGLE_VERTICAL, m_numTextSize,
|
plotNum( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue