KiCad PCB EDA Suite
|
#include <gr_basic.h>
#include <plotters/plotter.h>
#include <trigo.h>
#include <math/util.h>
#include <font/font.h>
#include <callback_gal.h>
Go to the source code of this file.
Functions | |
int | GetPenSizeForBold (int aTextSize) |
int | GetPenSizeForDemiBold (int aTextSize) |
int | GetPenSizeForBold (const wxSize &aTextSize) |
int | GetPenSizeForDemiBold (const wxSize &aTextSize) |
int | GetPenSizeForNormal (int aTextSize) |
int | GetPenSizeForNormal (const wxSize &aTextSize) |
int | Clamp_Text_PenSize (int aPenSize, int aSize, bool aStrict) |
Pen width should not allow characters to become cluttered up in their own fatness. | |
float | Clamp_Text_PenSize (float aPenSize, int aSize, bool aStrict) |
int | Clamp_Text_PenSize (int aPenSize, const VECTOR2I &aSize, bool aStrict) |
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. | |
float Clamp_Text_PenSize | ( | float | aPenSize, |
int | aSize, | ||
bool | aStrict | ||
) |
Definition at line 96 of file gr_text.cpp.
References scale.
int Clamp_Text_PenSize | ( | int | aPenSize, |
const VECTOR2I & | aSize, | ||
bool | aStrict | ||
) |
Definition at line 105 of file gr_text.cpp.
References std::abs(), Clamp_Text_PenSize(), VECTOR2< T >::x, and VECTOR2< T >::y.
int Clamp_Text_PenSize | ( | int | aPenSize, |
int | aSize, | ||
bool | aStrict | ||
) |
Pen width should not allow characters to become cluttered up in their own fatness.
Normal text is normally around 15% the fontsize, and bold text around 20%. So we set a hard limit at 25%, and a secondary limit for non-decorative text that must be readable at small sizes at 18%.
aPenSize | is the pen size to clamp. |
aSize | is the character size (height or width). |
aBold | use true if text accept bold pen size. |
Definition at line 87 of file gr_text.cpp.
References KiROUND(), and scale.
Referenced by Clamp_Text_PenSize(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT::GetEffectiveTextPenWidth(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::Validate(), and DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate().
int GetPenSizeForBold | ( | const wxSize & | aTextSize | ) |
Definition at line 52 of file gr_text.cpp.
References GetPenSizeForBold().
int GetPenSizeForBold | ( | int | aTextSize | ) |
aTextSize | is the char size (height or width). |
Definition at line 40 of file gr_text.cpp.
References KiROUND().
Referenced by EDA_TEXT::GetEffectiveTextPenWidth(), GetPenSizeForBold(), GRPrintText(), InferBold(), FEATURES_MANAGER::InitFeatureList(), SCH_IO_KICAD_LEGACY::loadText(), DIALOG_DIMENSION_PROPERTIES::onBoldToggle(), DIALOG_TEXT_PROPERTIES::onBoldToggle(), DIALOG_TEXTBOX_PROPERTIES::onBoldToggle(), DIALOG_DIMENSION_PROPERTIES::onFontSelected(), DIALOG_TEXT_PROPERTIES::onFontSelected(), DIALOG_TEXTBOX_PROPERTIES::onFontSelected(), DIALOG_DIMENSION_PROPERTIES::onThickness(), DIALOG_TEXT_PROPERTIES::onThickness(), DIALOG_TEXTBOX_PROPERTIES::onThickness(), PLOTTER::PlotText(), EDA_TEXT::SetBold(), DS_DATA_ITEM_TEXT::SyncDrawItems(), PLOTTER::Text(), and DIALOG_TEXT_PROPERTIES::updateTextThickness().
int GetPenSizeForDemiBold | ( | const wxSize & | aTextSize | ) |
Definition at line 58 of file gr_text.cpp.
References GetPenSizeForDemiBold().
int GetPenSizeForDemiBold | ( | int | aTextSize | ) |
aTextSize | the char size (height or width). |
Definition at line 46 of file gr_text.cpp.
References KiROUND().
Referenced by KIGFX::SCH_PAINTER::draw(), and GetPenSizeForDemiBold().
int GetPenSizeForNormal | ( | const wxSize & | aTextSize | ) |
Definition at line 70 of file gr_text.cpp.
References GetPenSizeForNormal().
int GetPenSizeForNormal | ( | int | aTextSize | ) |
aTextSize | = the char size (height or width). |
Definition at line 64 of file gr_text.cpp.
References KiROUND().
Referenced by KIGFX::PCB_PAINTER::draw(), EDA_TEXT::GetEffectiveTextPenWidth(), GetPenSizeForNormal(), GRPrintText(), InferBold(), DIALOG_DIMENSION_PROPERTIES::onBoldToggle(), DIALOG_TEXT_PROPERTIES::onBoldToggle(), DIALOG_TEXTBOX_PROPERTIES::onBoldToggle(), DIALOG_DIMENSION_PROPERTIES::onFontSelected(), DIALOG_TEXT_PROPERTIES::onFontSelected(), DIALOG_TEXTBOX_PROPERTIES::onFontSelected(), DIALOG_DIMENSION_PROPERTIES::onThickness(), DIALOG_TEXT_PROPERTIES::onThickness(), DIALOG_TEXTBOX_PROPERTIES::onThickness(), PIN_LAYOUT_CACHE::recomputeExtentsCache(), EDA_TEXT::SetBold(), DIALOG_TEXT_PROPERTIES::updateTextThickness(), and SCH_PIN::validateExtentsCache().
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.
aDC | is the current Device Context. |
aPos | is the text position (according to h_justify, v_justify). |
aColor | is the text color. |
aText | is the text to draw. |
aOrient | is the angle. |
aSize | is the text size (size.x or size.y can be < 0 for mirrored texts). |
aH_justify | is the horizontal justification (Left, center, right). |
aV_justify | is the vertical justification (bottom, center, top). |
aWidth | is the line width (pen width) (use default width if aWidth = 0). if width < 0 : draw segments in sketch mode, width = abs(width) Use a value min(aSize.x, aSize.y) / 5 for a bold text. |
aItalic | is the true to simulate an italic font. |
aBold | use true to use a bold font. Useful only with default width value (aWidth = 0). |
aFont | is the font to use, or nullptr for the KiCad stroke font |
Definition at line 142 of file gr_text.cpp.
References KIFONT::FONT::Draw(), KIFONT::FONT::GetFont(), GetPenSizeForBold(), GetPenSizeForNormal(), GRClosedPoly(), GRCSegm(), GRLine(), TEXT_ATTRIBUTES::m_Angle, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SCH_FIELD::Print(), SCH_TEXT::Print(), EDA_TEXT::printOneLineOfText(), SCH_PIN::printPinElectricalTypeName(), and SCH_PIN::printPinTexts().
int GRTextWidth | ( | const wxString & | aText, |
KIFONT::FONT * | aFont, | ||
const VECTOR2I & | aSize, | ||
int | aThickness, | ||
bool | aBold, | ||
bool | aItalic, | ||
const KIFONT::METRICS & | aFontMetrics | ||
) |
Definition at line 113 of file gr_text.cpp.
References KIFONT::FONT::GetFont(), KiROUND(), KIFONT::FONT::StringBoundaryLimits(), and VECTOR2< T >::x.
Referenced by SVG_PLOTTER::Text(), and ROUTER_STATUS_VIEW_ITEM::ViewDraw().