KiCad PCB EDA Suite
draw_graphic_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 EDA_DRAW_PANEL;
52 class PLOTTER;
53 
66 int Clamp_Text_PenSize( int 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 DrawGraphicText( EDA_RECT* aClipBox,
109  wxDC * aDC,
110  const wxPoint &aPos,
111  const COLOR4D aColor,
112  const wxString &aText,
113  double aOrient,
114  const wxSize &aSize,
115  enum EDA_TEXT_HJUSTIFY_T aH_justify,
116  enum EDA_TEXT_VJUSTIFY_T aV_justify,
117  int aWidth,
118  bool aItalic,
119  bool aBold,
120  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
121  void* aCallbackData = nullptr,
122  PLOTTER * aPlotter = nullptr );
123 
124 
131 void DrawGraphicHaloText( EDA_RECT* aClipBox,
132  wxDC * aDC,
133  const wxPoint &aPos,
134  const COLOR4D aBgColor,
135  COLOR4D aColor1,
136  COLOR4D aColor2,
137  const wxString &aText,
138  double aOrient,
139  const wxSize &aSize,
140  enum EDA_TEXT_HJUSTIFY_T aH_justify,
141  enum EDA_TEXT_VJUSTIFY_T aV_justify,
142  int aWidth,
143  bool aItalic,
144  bool aBold,
145  void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
146  void* aCallbackData = nullptr,
147  PLOTTER * aPlotter = nullptr );
148 
149 #endif /* __INCLUDE__DRAWTXT_H__ */
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool italic, bool bold)
Function GraphicTextWidth.
void DrawGraphicText(EDA_RECT *aClipBox, 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 DrawGraphicText Draw a graphic text (like module texts)
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:62
Definition of base KiCad text object.
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:69
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Base plotter engine class.
Definition: plotter.h:97
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
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...
Basic classes for most KiCad items.
void DrawGraphicHaloText(EDA_RECT *aClipBox, 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. ...
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39