Update pin plotting to match pin painting.

(In particular, we moved the number to the top when the name is
not shown, but forgot to update the plotter.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15501
This commit is contained in:
Jeff Young 2023-08-29 11:07:17 +01:00
parent a9a2d4aa7a
commit c3d6fecccc
1 changed files with 31 additions and 15 deletions

View File

@ -908,33 +908,49 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
{
/* Its an horizontal line. */
if( aDrawPinName )
{
x = ( x1 + aPinPos.x) / 2;
if( aDrawPinName && aDrawPinNum )
{
plotText( x, y1 - name_offset, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
}
if( aDrawPinNum )
{
x = ( x1 + aPinPos.x ) / 2;
plotText( x, y1 + num_offset, numColor, number, ANGLE_HORIZONTAL, m_numTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth );
}
else if( aDrawPinName )
{
plotText( x, y1 - name_offset, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
}
else /* Its a vertical line. */
else if( aDrawPinNum )
{
if( aDrawPinName )
plotText( x, y1 - name_offset, numColor, number, ANGLE_HORIZONTAL, m_numTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
}
}
else
{
/* Its a vertical line. */
y = ( y1 + aPinPos.y ) / 2;
if( aDrawPinName && aDrawPinNum )
{
plotText( x1 - name_offset, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
plotText( x1 + num_offset, y, numColor, number, ANGLE_VERTICAL, m_numTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth );
}
else if( aDrawPinName )
{
plotText( x1 - name_offset, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
}
if( aDrawPinNum )
else if( aDrawPinNum )
{
plotText( x1 + num_offset, ( y1 + aPinPos.y ) / 2, numColor, number, ANGLE_VERTICAL,
m_numTextSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth );
plotText( x1 - num_offset, y, numColor, number, ANGLE_VERTICAL, m_numTextSize,
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
}
}
}