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-2014 KiCad Developers, see CHANGELOG.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 <base_struct.h>
35 #include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
36 
37 /* Minimum dimension in pixel for drawing/no drawing a text
38  * used in Pcbnew to decide to draw (or not) some texts
39  * ( like net names on pads/tracks )
40  * When a text height is smaller than MIN_TEXT_SIZE,
41  * it is not drawn by Pcbnew
42  */
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, wxSize aSize, bool aBold = true );
68 
74 int GetPenSizeForBold( int aTextSize );
75 
81 int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, bool bold );
82 
108 void GRText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aColor, const wxString &aText,
109  double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
110  enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
111  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
112  void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
113 
114 
121 void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
122  COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
123  enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
124  int aWidth, bool aItalic, bool aBold,
125  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
126  void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
127 
128 #endif /* __INCLUDE__DRAWTXT_H__ */
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool italic, bool bold)
Function GraphicTextWidth.
Definition: gr_text.cpp:90
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:49
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold=true)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
Definition: gr_text.cpp:64
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
Base plotter engine class.
Definition: plotter.h:97
void GRHaloText(wxDC *aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1, 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:171
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)
Function GRText Draw a graphic text (like module texts)
Definition: gr_text.cpp:126
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39