KiCad PCB EDA Suite
drawtxt.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 
105 void DrawGraphicText( EDA_RECT* aClipBox,
106  wxDC * aDC,
107  const wxPoint &aPos,
108  const COLOR4D aColor,
109  const wxString &aText,
110  double aOrient,
111  const wxSize &aSize,
112  enum EDA_TEXT_HJUSTIFY_T aH_justify,
113  enum EDA_TEXT_VJUSTIFY_T aV_justify,
114  int aWidth,
115  bool aItalic,
116  bool aBold,
117  void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL,
118  PLOTTER * aPlotter = NULL );
119 
120 
127 void DrawGraphicHaloText( EDA_RECT* aClipBox,
128  wxDC * aDC,
129  const wxPoint &aPos,
130  const COLOR4D aBgColor,
131  COLOR4D aColor1,
132  COLOR4D aColor2,
133  const wxString &aText,
134  double aOrient,
135  const wxSize &aSize,
136  enum EDA_TEXT_HJUSTIFY_T aH_justify,
137  enum EDA_TEXT_VJUSTIFY_T aV_justify,
138  int aWidth,
139  bool aItalic,
140  bool aBold,
141  void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL,
142  PLOTTER * aPlotter = NULL );
143 
144 #endif /* __INCLUDE__DRAWTXT_H__ */
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: drawtxt.cpp:49
Definition of base KiCad text object.
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool italic, bool bold)
Function GraphicTextWidth.
Definition: drawtxt.cpp:88
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)=NULL, PLOTTER *aPlotter=NULL)
Function DrawGraphicText Draw a graphic text (like module texts)
Definition: drawtxt.cpp:122
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:54
Base plotter engine class.
Definition: class_plotter.h:97
Class EDA_RECT handles the component boundary box.
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)=NULL, PLOTTER *aPlotter=NULL)
Draw graphic text with a border, so that it can be read on different backgrounds. ...
Definition: drawtxt.cpp:176
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: drawtxt.cpp:67
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39