![]() |
KiCad PCB EDA Suite
|
#include <gr_basic.h>
#include <plotters/plotter.h>
#include <eda_text.h>
#include <trigo.h>
#include <base_screen.h>
#include <math/util.h>
#include <basic_gal.h>
Go to the source code of this file.
Functions | |
int | GetPenSizeForBold (int aTextSize) |
int | GetPenSizeForNormal (int aTextSize) |
int | Clamp_Text_PenSize (int aPenSize, int aSize, bool aBold) |
Don't allow text to become cluttered up in its own fatness. More... | |
float | Clamp_Text_PenSize (float aPenSize, int aSize, bool aBold) |
int | Clamp_Text_PenSize (int aPenSize, const wxSize &aSize, bool aBold) |
int | GraphicTextWidth (const wxString &aText, const wxSize &aSize, bool aItalic, bool aBold) |
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), void *aCallbackData, PLOTTER *aPlotter) |
Draw a graphic text (like footprint texts). 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), void *aCallbackData, PLOTTER *aPlotter) |
Draw graphic text with a border so that it can be read on different backgrounds. More... | |
int Clamp_Text_PenSize | ( | int | aPenSize, |
int | aSize, | ||
bool | aBold | ||
) |
Don't allow text to become cluttered up in its own fatness.
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 | ||
) |
int Clamp_Text_PenSize | ( | int | aPenSize, |
const wxSize & | aSize, | ||
bool | aBold | ||
) |
Definition at line 85 of file gr_text.cpp.
References Clamp_Text_PenSize().
int GetPenSizeForBold | ( | int | aTextSize | ) |
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 texts).
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().