KiCad PCB EDA Suite
gr_text.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2009-2014 Jerry Jacobs
5  * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
31 #ifndef __INCLUDE__DRAWTXT_H__
32 #define __INCLUDE__DRAWTXT_H__ 1
33 
34 #include <eda_item.h>
35 #include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
36 
43 #define MIN_TEXT_SIZE 5
44 
45 /* Absolute minimum dimension in pixel to draw a text as text or a line
46  * When a text height is smaller than MIN_DRAWABLE_TEXT_SIZE,
47  * it is drawn, but like a line by the draw text function
48 */
49 #define MIN_DRAWABLE_TEXT_SIZE 3
50 
51 class PLOTTER;
52 
65 int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold = true );
66 float Clamp_Text_PenSize( float aPenSize, int aSize, bool aBold = true );
67 int Clamp_Text_PenSize( int aPenSize, const wxSize& aSize, bool aBold = true );
68 
73 int GetPenSizeForBold( int aTextSize );
74 
79 int GetPenSizeForNormal( int aTextSize );
80 
86 int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, bool bold );
87 
113 void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxString& aText,
114  double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
115  enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
116  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
117  void* aCallbackData = nullptr, PLOTTER* aPlotter = nullptr );
118 
119 
126 void GRHaloText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aBgColor, const COLOR4D& aColor1,
127  const COLOR4D& aColor2, const wxString& aText, double aOrient, const wxSize& aSize,
128  enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
129  int aWidth, bool aItalic, bool aBold,
130  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
131  void* aCallbackData = nullptr, PLOTTER* aPlotter = nullptr );
132 
133 #endif /* __INCLUDE__DRAWTXT_H__ */
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:61
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool italic, bool bold)
The full X size is GraphicTextWidth + the thickness of graphic lines.
Definition: gr_text.cpp:94
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)
Definition: gr_text.cpp:130
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:47
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 fa...
Definition: gr_text.cpp:68
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:53
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.
Definition: gr_text.cpp:174
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:68
Base plotter engine class.
Definition: plotter.h:121
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103