Make sure plotter uses default font when specified.
This commit is contained in:
parent
f11b8011cd
commit
082c6f5bd6
|
@ -120,7 +120,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
||||
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
||||
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
||||
text->IsMultilineAllowed(), text->GetFont() );
|
||||
text->IsMultilineAllowed(), text->GetDrawFont() );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
|
||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||
penWidth, IsItalic(), IsBold() );
|
||||
penWidth, IsItalic(), IsBold(), false, GetDrawFont() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -707,14 +707,10 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
return;
|
||||
|
||||
int x, y;
|
||||
wxSize pinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
|
||||
wxSize pinNumSize = wxSize( m_numTextSize, m_numTextSize );
|
||||
|
||||
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
|
||||
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
|
||||
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
|
||||
|
||||
|
@ -733,6 +729,15 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
case PIN_RIGHT: x1 += m_length; break;
|
||||
}
|
||||
|
||||
auto plotText =
|
||||
[&]( int x, int y, const COLOR4D& color, const wxString& text, const EDA_ANGLE& angle,
|
||||
int size, GR_TEXT_H_ALIGN_T hJustify, GR_TEXT_V_ALIGN_T vJustify, int penWidth )
|
||||
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( x, y ), color, text, angle, VECTOR2I( size, size ),
|
||||
hJustify, vJustify, penWidth, false, false, false, GetDrawFont() );
|
||||
};
|
||||
|
||||
/* Draw the text inside, but the pin numbers outside. */
|
||||
if( aTextInside )
|
||||
{
|
||||
|
@ -752,14 +757,15 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
hjustify = GR_TEXT_H_ALIGN_RIGHT;
|
||||
}
|
||||
|
||||
aPlotter->Text( VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL, pinNameSize,
|
||||
hjustify, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false );
|
||||
plotText( x, y1, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize, hjustify,
|
||||
GR_TEXT_V_ALIGN_CENTER, namePenWidth );
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
|
||||
number, ANGLE_HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
|
||||
plotText( ( x1 + aPinPos.x) / 2, y1 - num_offset, numColor, number,
|
||||
ANGLE_HORIZONTAL, m_numTextSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
||||
}
|
||||
}
|
||||
else /* Its a vertical line. */
|
||||
|
@ -769,15 +775,16 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
y = y1 + aTextInside;
|
||||
|
||||
if( aDrawPinName )
|
||||
aPlotter->Text( VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
|
||||
pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER,
|
||||
namePenWidth, false, false );
|
||||
{
|
||||
plotText( x1, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
||||
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth );
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
||||
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
|
||||
plotText( x1 - num_offset, ( y1 + aPinPos.y) / 2, numColor, number,
|
||||
ANGLE_VERTICAL, m_nameTextSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
||||
}
|
||||
}
|
||||
else /* PIN_UP */
|
||||
|
@ -786,16 +793,15 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
|
||||
if( aDrawPinName )
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
|
||||
pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER,
|
||||
namePenWidth, false, false );
|
||||
plotText( x1, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth );
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
||||
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
|
||||
plotText( x1 - num_offset, ( y1 + aPinPos.y) / 2, numColor, number,
|
||||
ANGLE_VERTICAL, m_numTextSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -808,17 +814,15 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
if( aDrawPinName )
|
||||
{
|
||||
x = ( x1 + aPinPos.x) / 2;
|
||||
aPlotter->Text( VECTOR2I( x, y1 - name_offset ), nameColor, name, ANGLE_HORIZONTAL,
|
||||
pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
||||
namePenWidth, false, false );
|
||||
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;
|
||||
aPlotter->Text( VECTOR2I( x, y1 + num_offset ), numColor, number, ANGLE_HORIZONTAL,
|
||||
pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP,
|
||||
numPenWidth, false, false );
|
||||
plotText( x, y1 + num_offset, numColor, number, ANGLE_HORIZONTAL, m_numTextSize,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth );
|
||||
}
|
||||
}
|
||||
else /* Its a vertical line. */
|
||||
|
@ -826,16 +830,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
|
|||
if( aDrawPinName )
|
||||
{
|
||||
y = ( y1 + aPinPos.y ) / 2;
|
||||
aPlotter->Text( VECTOR2I( x1 - name_offset, y ), nameColor, name, ANGLE_VERTICAL,
|
||||
pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
||||
namePenWidth, false, false );
|
||||
plotText( x1 - name_offset, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth );
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor,
|
||||
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,7 +288,8 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
|
|||
int penWidth = std::max( GetEffectiveTextPenWidth(), settings->GetMinPenWidth() );
|
||||
|
||||
plotter->Text( pos, color, GetText(), t1 ? ANGLE_HORIZONTAL : ANGLE_VERTICAL, GetTextSize(),
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold() );
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(),
|
||||
true, GetDrawFont() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -956,7 +956,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
VECTOR2I textpos = GetBoundingBox().Centre();
|
||||
|
||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||
penWidth, IsItalic(), IsBold() );
|
||||
penWidth, IsItalic(), IsBold(), false, GetDrawFont() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -826,7 +826,8 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
else
|
||||
{
|
||||
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
|
||||
false, GetDrawFont() );
|
||||
|
||||
if( s_poly.size() )
|
||||
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
||||
|
|
|
@ -421,8 +421,8 @@ public:
|
|||
int aPenWidth,
|
||||
bool aItalic,
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false,
|
||||
KIFONT::FONT* aFont = nullptr,
|
||||
bool aMultilineAllowed,
|
||||
KIFONT::FONT* aFont,
|
||||
void* aData = nullptr );
|
||||
|
||||
/**
|
||||
|
|
|
@ -257,7 +257,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
|||
wxString Text = wxT( "Drill Map:" );
|
||||
plotter->Text( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, ANGLE_HORIZONTAL,
|
||||
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false,
|
||||
false, nullptr /* stroke font */ );
|
||||
|
||||
// For some formats (PS, PDF SVG) we plot the drill size list on more than one column
|
||||
// because the list must be contained inside the printed page
|
||||
|
@ -318,7 +319,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
|||
|
||||
plotter->Text( VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, ANGLE_HORIZONTAL,
|
||||
VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false,
|
||||
false, nullptr /* stroke font */ );
|
||||
|
||||
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue