39 return KiROUND( aTextSize / 5.0 );
45 return KiROUND( aTextSize / 6.0 );
63 return KiROUND( aTextSize / 8.0 );
75 double scale = aStrict ? 0.18 : 0.25;
78 return std::min( aPenSize, maxWidth );
84 double scale = aStrict ? 0.18 : 0.25;
85 float maxWidth = (float) aSize *
scale;
87 return std::min( aPenSize, maxWidth );
100 int aThickness,
bool aBold,
bool aItalic,
const KIFONT::METRICS& aFontMetrics )
104 wxString evaluated( aText );
106 if( evaluated.Contains( wxS(
"@{" ) ) )
109 evaluated = evaluator.
Evaluate( evaluated );
120 int aWidth,
bool aItalic,
bool aBold,
KIFONT::FONT* aFont,
124 bool fill_mode =
true;
125 wxString evaluatedText( aText );
127 if( evaluatedText.Contains( wxS(
"@{" ) ) )
130 evaluatedText = evaluator.
Evaluate( evaluatedText );
155 GRLine( aDC, aPt1, aPt2, aWidth, aColor );
157 GRCSegm( aDC, aPt1, aPt2, aWidth, aColor );
162 GRClosedPoly( aDC, aPoly.PointCount(), aPoly.CPoints().data(),
true, aColor );
167 attributes.m_StrokeWidth = aWidth;
168 attributes.m_Italic = aItalic;
169 attributes.m_Bold = aBold;
170 attributes.m_Halign = aH_justify;
171 attributes.m_Valign = aV_justify;
172 attributes.m_Size = aSize;
174 aFont->
Draw( &callback_gal, evaluatedText, aPos, attributes, aFontMetrics );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
High-level wrapper for evaluating mathematical and string expressions in wxString format.
wxString Evaluate(const wxString &aInput)
Main evaluation function - processes input string and evaluates all} expressions.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void GRCSegm(wxDC *DC, const VECTOR2I &A, const VECTOR2I &B, int width, const COLOR4D &Color)
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
void GRClosedPoly(wxDC *DC, int n, const VECTOR2I *Points, bool Fill, const COLOR4D &Color)
Draw a closed polyline and fill it if Fill, in object space.
int GetPenSizeForBold(int aTextSize)
int GetPenSizeForDemiBold(int aTextSize)
int GetPenSizeForNormal(int aTextSize)
int GRTextWidth(const wxString &aText, KIFONT::FONT *aFont, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const KIFONT::METRICS &aFontMetrics)
void GRPrintText(wxDC *aDC, const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics)
Print a graphic text through wxDC.
int ClampTextPenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
VECTOR2< int32_t > VECTOR2I