![]() |
KiCad PCB EDA Suite
|
Go to the source code of this file.
Macros | |
#define | MIN_TEXT_SIZE 5 |
Minimum dimension in pixel for drawing/no drawing a text used in Pcbnew to decide to draw (or not) some texts ( like net names on pads/tracks ). More... | |
#define | MIN_DRAWABLE_TEXT_SIZE 3 |
Functions | |
int | Clamp_Text_PenSize (int aPenSize, int aSize, bool aBold=true) |
As a rule, pen width should not be >1/4em, otherwise the character will be cluttered up in its own fatness. More... | |
float | Clamp_Text_PenSize (float aPenSize, int aSize, bool aBold=true) |
int | Clamp_Text_PenSize (int aPenSize, const wxSize &aSize, bool aBold=true) |
int | GetPenSizeForBold (int aTextSize) |
int | GetPenSizeForNormal (int aTextSize) |
int | GraphicTextWidth (const wxString &aText, const wxSize &aSize, bool italic, bool bold) |
The full X size is GraphicTextWidth + the thickness of graphic lines. More... | |
void | GRText (wxDC *aDC, const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData)=nullptr, void *aCallbackData=nullptr, PLOTTER *aPlotter=nullptr) |
Draw a graphic text (like footprint text) More... | |
void | GRHaloText (wxDC *aDC, const wxPoint &aPos, const COLOR4D &aBgColor, const COLOR4D &aColor1, const COLOR4D &aColor2, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData)=nullptr, void *aCallbackData=nullptr, PLOTTER *aPlotter=nullptr) |
Draw graphic text with a border so that it can be read on different backgrounds. More... | |
#define MIN_TEXT_SIZE 5 |
int Clamp_Text_PenSize | ( | int | aPenSize, |
int | aSize, | ||
bool | aBold | ||
) |
As a rule, pen width should not be >1/4em, otherwise the character will be cluttered up in its own fatness.
The pen width max is aSize/4 for bold texts, and aSize/6 for normal texts. The "best" pen width is aSize/5 for bold texts so the clamp is consistent with bold option.
aPenSize | the pen size to clamp. |
aSize | the char size (height or width, or its wxSize). |
aBold | true if text accept bold pen size. |
As a rule, pen width should not be >1/4em, otherwise the character will be cluttered up in its own fatness.
Bold fonts are generally around aSize/5 in width, so we limit them to aSize/4, and normal text to aSize/6.
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 67 of file gr_text.cpp.
References KiROUND(), and scale.
Referenced by Clamp_Text_PenSize(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT::GetEffectiveTextPenWidth(), LIB_PIN::PlotPinTexts(), LIB_PIN::printPinTexts(), and DIALOG_TEXT_PROPERTIES::TransferDataFromWindow().
float Clamp_Text_PenSize | ( | float | aPenSize, |
int | aSize, | ||
bool | aBold = true |
||
) |
int Clamp_Text_PenSize | ( | int | aPenSize, |
const wxSize & | aSize, | ||
bool | aBold = true |
||
) |
Definition at line 85 of file gr_text.cpp.
References Clamp_Text_PenSize().
int GetPenSizeForBold | ( | int | aTextSize | ) |
aTextSize | the char size (height or width). |
aTextSize | is the char size (height or width). |
Definition at line 46 of file gr_text.cpp.
References KiROUND().
Referenced by EDA_TEXT::GetEffectiveTextPenWidth(), GRText(), SCH_LEGACY_PLUGIN::loadText(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DS_DATA_ITEM_TEXT::SyncDrawItems(), and DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow().
int GetPenSizeForNormal | ( | int | aTextSize | ) |
aTextSize | = the char size (height or width). |
Definition at line 52 of file gr_text.cpp.
References KiROUND().
Referenced by EDA_TEXT::GetEffectiveTextPenWidth().
int GraphicTextWidth | ( | const wxString & | aText, |
const wxSize & | aSize, | ||
bool | italic, | ||
bool | bold | ||
) |
The full X size is GraphicTextWidth + the thickness of graphic lines.
Definition at line 93 of file gr_text.cpp.
References basic_gal, KIGFX::GAL::GetTextLineSize(), KiROUND(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetGlyphSize(), and VECTOR2< T >::x.
Referenced by SVG_PLOTTER::Text().
void GRHaloText | ( | wxDC * | aDC, |
const wxPoint & | aPos, | ||
const COLOR4D & | aBgColor, | ||
const COLOR4D & | aColor1, | ||
const COLOR4D & | aColor2, | ||
const wxString & | aText, | ||
double | aOrient, | ||
const wxSize & | aSize, | ||
enum EDA_TEXT_HJUSTIFY_T | aH_justify, | ||
enum EDA_TEXT_VJUSTIFY_T | aV_justify, | ||
int | aWidth, | ||
bool | aItalic, | ||
bool | aBold, | ||
void(*)(int x0, int y0, int xf, int yf, void *aData) | aCallback = nullptr , |
||
void * | aCallbackData = nullptr , |
||
PLOTTER * | aPlotter = nullptr |
||
) |
Draw graphic text with a border so that it can be read on different backgrounds.
See GRText for most of the parameters. If aBgColor is a dark color text is drawn in aColor2 with aColor1 border. Otherwise colors are swapped.
Definition at line 173 of file gr_text.cpp.
References KIGFX::COLOR4D::GetBrightness(), and GRText().
void GRText | ( | wxDC * | aDC, |
const wxPoint & | aPos, | ||
const COLOR4D & | aColor, | ||
const wxString & | aText, | ||
double | aOrient, | ||
const wxSize & | aSize, | ||
enum EDA_TEXT_HJUSTIFY_T | aH_justify, | ||
enum EDA_TEXT_VJUSTIFY_T | aV_justify, | ||
int | aWidth, | ||
bool | aItalic, | ||
bool | aBold, | ||
void(*)(int x0, int y0, int xf, int yf, void *aData) | aCallback, | ||
void * | aCallbackData, | ||
PLOTTER * | aPlotter | ||
) |
Draw a graphic text (like footprint text)
aClipBox | the clipping rect, or NULL if no clipping. |
aDC | the current Device Context. NULL if draw within a 3D GL Canvas. |
aPos | text position (according to h_justify, v_justify). |
aColor | (COLOR4D) = text color. |
aText | text to draw. |
aOrient | angle in 0.1 degree. |
aSize | text size (size.x or size.y can be < 0 for mirrored texts). |
aH_justify | horizontal justification (Left, center, right). |
aV_justify | vertical justification (bottom, center, top). |
aWidth | line width (pen width) (default = 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 | true to simulate an italic font. |
aBold | true to use a bold font. |
aCallback | ( int x0, int y0, int xf, int yf, void* aData ) is a function called (if non null) to draw each segment. used to draw 3D texts or for plotting. NULL for normal drawings. |
aCallbackData | is the auxiliary parameter aData for the callback function. This can be nullptr if no auxiliary parameter is needed. |
aPlotter | = a pointer to a PLOTTER instance, when this function is used to plot the text. NULL to draw this text. |
Draw a graphic text (like footprint text)
aDC | is the current Device Context. NULL if draw within a 3D GL Canvas. |
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 in 0.1 degree. |
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). |
aCallback( | int x0, int y0, int xf, int yf, void* aData ) is a function called (if non null) to draw each segment. used to draw 3D texts or for plotting. NULL for normal drawings |
aCallbackData | is the auxiliary parameter aData for the callback function. can be nullptr if no auxiliary parameter is needed |
aPlotter | is a PLOTTER instance, when this function is used to plot the text. NULL to draw this text. |
Definition at line 129 of file gr_text.cpp.
References basic_gal, dummy(), GetPenSizeForBold(), BASIC_GAL::m_Color, BASIC_GAL::m_DC, BASIC_GAL::SetCallback(), BASIC_GAL::SetClipBox(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetLineWidth(), BASIC_GAL::SetPlotter(), KIGFX::GAL::SetTextAttributes(), and KIGFX::GAL::StrokeText().
Referenced by BOARD_ADAPTER::addFootprintShapesWithClearance(), BOARD_ADAPTER::addShapeWithClearance(), GRHaloText(), LIB_TEXT::print(), SCH_FIELD::Print(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), LIB_PIN::printPinElectricalTypeName(), LIB_PIN::printPinTexts(), PLOTTER::Text(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), and EDA_TEXT::TransformToSegmentList().