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 
54 {
57 };
58 
59 int GetTextMarkupFlags();
60 void SetTextMarkupFlags( int aMarkupFlags );
61 
74 int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold = true );
75 float Clamp_Text_PenSize( float aPenSize, int aSize, bool aBold = true );
76 int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold = true );
77 
83 int GetPenSizeForBold( int aTextSize );
84 
90 int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, bool bold );
91 
117 void GRText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aColor, const wxString &aText,
118  double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
119  enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
120  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
121  void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
122 
123 
130 void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
131  COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
132  enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
133  int aWidth, bool aItalic, bool aBold,
134  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
135  void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
136 
137 #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:107
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:66
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:81
TEXT_MARKUP_FLAGS
Definition: gr_text.h:53
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
Base plotter engine class.
Definition: plotter.h:103
void SetTextMarkupFlags(int aMarkupFlags)
Definition: gr_text.cpp:49
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:188
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:143
int GetTextMarkupFlags()
Definition: gr_text.cpp:55
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39