KiCad PCB EDA Suite
eda_text.cpp
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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2017 KiCad Developers, see change_log.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 
30 #include <eda_text.h>
31 #include <drawtxt.h>
32 #include <class_eda_rect.h>
33 #include <macros.h>
34 #include <trigo.h> // RotatePoint
35 #include <class_drawpanel.h> // EDA_DRAW_PANEL
36 
37 #include <basic_gal.h>
38 
39 // Conversion to application internal units defined at build time.
40 #if defined( PCBNEW )
41  #include <class_board_item.h> // for FMT_IU
42 #elif defined( EESCHEMA )
43  #include <sch_item_struct.h> // for FMT_IU
44 #elif defined( GERBVIEW )
45 #elif defined( PL_EDITOR )
46  #include <base_units.h>
47  #define FMT_IU Double2Str
48 #else
49 #error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
50 #endif
51 
52 #include <convert_to_biu.h>
53 
54 EDA_TEXT::EDA_TEXT( const wxString& text ) :
55  m_Text( text ),
56  m_e( 1<<TE_VISIBLE )
57 {
58  int sz = Mils2iu( DEFAULT_SIZE_TEXT );
59  SetTextSize( wxSize( sz, sz ) );
60 }
61 
62 
64 {
65 }
66 
67 
68 void EDA_TEXT::SetEffects( const EDA_TEXT& aSrc )
69 {
70  m_e = aSrc.m_e;
71 }
72 
73 
74 void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
75 {
76  std::swap( m_e, aTradingPartner.m_e );
77 }
78 
79 
80 int EDA_TEXT::LenSize( const wxString& aLine ) const
81 {
85 
86  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
87 
88  return KiROUND( tsize.x );
89 }
90 
91 
93 {
94  wxString tmp = GetShownText();
95 
96  tmp.Replace( wxT( "\n" ), wxT( " " ) );
97  tmp.Replace( wxT( "\r" ), wxT( " " ) );
98  tmp.Replace( wxT( "\t" ), wxT( " " ) );
99 
100  if( tmp.Length() > 15 )
101  tmp = tmp.Left( 12 ) + wxT( "..." );
102 
103  return tmp;
104 }
105 
106 
107 int EDA_TEXT::GetInterline( int aTextThickness ) const
108 {
109  int thickness = aTextThickness <= 0 ? GetThickness() : aTextThickness;
110 
111  return KiROUND( KIGFX::STROKE_FONT::GetInterline( GetTextHeight(), thickness ) );
112 }
113 
114 
115 EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
116 {
117  EDA_RECT rect;
118  wxArrayString strings;
119  wxString text = GetShownText();
120  int thickness = ( aThickness < 0 ) ? GetThickness() : aThickness;
121  int linecount = 1;
122  bool hasOverBar = false; // true if the first line of text as an overbar
123 
124  if( IsMultilineAllowed() )
125  {
126  wxStringSplit( text, strings, '\n' );
127 
128  if( strings.GetCount() ) // GetCount() == 0 for void strings
129  {
130  if( aLine >= 0 && (aLine < (int)strings.GetCount()) )
131  text = strings.Item( aLine );
132  else
133  text = strings.Item( 0 );
134 
135  linecount = strings.GetCount();
136  }
137  }
138 
139  // Search for overbar symbol. Only text is scanned,
140  // because only this line can change the bounding box
141  for( unsigned ii = 1; ii < text.size(); ii++ )
142  {
143  if( text[ii-1] == '~' && text[ii] != '~' )
144  {
145  hasOverBar = true;
146  break;
147  }
148  }
149 
150  // calculate the H and V size
152  text, VECTOR2D( GetTextSize() ), double( thickness ) ).x );
153  int dy = GetInterline( thickness );
154 
155  // Creates bounding box (rectangle) for an horizontal
156  // and left and top justified text. the bounding box will be moved later
157  // according to the actual text options
158  wxSize textsize = wxSize( dx, dy );
159  wxPoint pos = GetTextPos();
160 
161  if( aInvertY )
162  pos.y = -pos.y;
163 
164  rect.SetOrigin( pos );
165 
166  // The bbox vertical size returned by GetInterline( aThickness )
167  // includes letters like j and y and ] + interval between lines.
168  // The interval below the last line is not usefull, and we can use its half value
169  // as vertical margin above the text
170  // the full interval is roughly GetTextHeight() * 0.4 - aThickness/2
171  rect.Move( wxPoint( 0, thickness/4 - KiROUND( GetTextHeight() * 0.22 ) ) );
172 
173  if( hasOverBar )
174  { // A overbar adds an extra size to the text
175  // Height from the base line text of chars like [ or {
176  double curr_height = GetTextHeight() * 1.15;
177  int extra_height = KiROUND(
178  basic_gal.GetStrokeFont().ComputeOverbarVerticalPosition( GetTextHeight(), thickness ) - curr_height );
179  extra_height += thickness/2;
180  textsize.y += extra_height;
181  rect.Move( wxPoint( 0, -extra_height ) );
182  }
183 
184  // for multiline texts and aLine < 0, merge all rectangles
185  // ( if aLine < 0, we want the full text bounding box )
186  if( IsMultilineAllowed() && aLine < 0 )
187  {
188  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
189  {
190  text = strings.Item( ii );
192  text, VECTOR2D( GetTextSize() ), double( thickness ) ).x );
193  textsize.x = std::max( textsize.x, dx );
194  textsize.y += dy;
195  }
196  }
197 
198  rect.SetSize( textsize );
199 
200  /* Now, calculate the rect origin, according to text justification
201  * At this point the rectangle origin is the text origin (m_Pos).
202  * This is true only for left and top text justified texts (using top to bottom Y axis
203  * orientation). and must be recalculated for others justifications
204  * also, note the V justification is relative to the first line
205  */
206  switch( GetHorizJustify() )
207  {
209  if( IsMirrored() )
210  rect.SetX( rect.GetX() - rect.GetWidth() );
211  break;
212 
214  rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
215  break;
216 
218  if( !IsMirrored() )
219  rect.SetX( rect.GetX() - rect.GetWidth() );
220  break;
221  }
222 
223  dy = GetTextHeight() + thickness;
224 
225  switch( GetVertJustify() )
226  {
228  break;
229 
231  rect.SetY( rect.GetY() - ( dy / 2) );
232  break;
233 
235  rect.SetY( rect.GetY() - dy );
236  break;
237  }
238 
239  if( linecount > 1 )
240  {
241  int yoffset;
242  linecount -= 1;
243 
244  switch( GetVertJustify() )
245  {
247  break;
248 
250  yoffset = linecount * GetInterline() / 2;
251  rect.SetY( rect.GetY() - yoffset );
252  break;
253 
255  yoffset = linecount * GetInterline( aThickness );
256  rect.SetY( rect.GetY() - yoffset );
257  break;
258  }
259  }
260 
261  rect.Normalize(); // Make h and v sizes always >= 0
262 
263  return rect;
264 }
265 
266 
267 bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
268 {
269  EDA_RECT rect = GetTextBox( -1 ); // Get the full text area.
270  wxPoint location = aPoint;
271 
272  rect.Inflate( aAccuracy );
273  RotatePoint( &location, GetTextPos(), -GetTextAngle() );
274 
275  return rect.Contains( location );
276 }
277 
278 
279 bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
280 {
281  EDA_RECT rect = aRect;
282 
283  rect.Inflate( aAccuracy );
284 
285  if( aContains )
286  return rect.Contains( GetTextBox( -1 ) );
287 
288  return rect.Intersects( GetTextBox( -1 ) );
289 }
290 
291 
292 void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
293  COLOR4D aColor, GR_DRAWMODE aDrawMode,
294  EDA_DRAW_MODE_T aFillMode, COLOR4D aAnchor_color )
295 {
296  if( IsMultilineAllowed() )
297  {
298  std::vector<wxPoint> positions;
299  wxArrayString strings;
300  wxStringSplit( GetShownText(), strings, '\n' );
301 
302  positions.reserve( strings.Count() );
303 
304  GetPositionsOfLinesOfMultilineText( positions, strings.Count() );
305 
306  for( unsigned ii = 0; ii < strings.Count(); ii++ )
307  {
308  wxString& txt = strings.Item( ii );
309  drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
310  aDrawMode, aFillMode, txt, positions[ii] );
311  }
312  }
313  else
314  drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
315  aDrawMode, aFillMode, GetShownText(), GetTextPos() );
316 
317  // Draw text anchor, if requested
318  if( aAnchor_color != COLOR4D::UNSPECIFIED )
319  {
320  GRDrawAnchor( aClipBox, aDC,
321  GetTextPos().x + aOffset.x, GetTextPos().y + aOffset.y,
322  DIM_ANCRE_TEXTE, aAnchor_color );
323  }
324 }
325 
326 
328  std::vector<wxPoint>& aPositions, int aLineCount ) const
329 {
330  wxPoint pos = GetTextPos(); // Position of first line of the
331  // multiline text according to
332  // the center of the multiline text block
333 
334  wxPoint offset; // Offset to next line.
335 
336  offset.y = GetInterline();
337 
338  if( aLineCount > 1 )
339  {
340  switch( GetVertJustify() )
341  {
343  break;
344 
346  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
347  break;
348 
350  pos.y -= ( aLineCount - 1 ) * offset.y;
351  break;
352  }
353  }
354 
355  // Rotate the position of the first line
356  // around the center of the multiline text block
357  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
358 
359  // Rotate the offset lines to increase happened in the right direction
360  RotatePoint( &offset, GetTextAngle() );
361 
362  for( int ii = 0; ii < aLineCount; ii++ )
363  {
364  aPositions.push_back( pos );
365  pos += offset;
366  }
367 }
368 
369 void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
370  const wxPoint& aOffset, COLOR4D aColor,
371  GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
372  const wxString& aText, const wxPoint &aPos )
373 {
374  int width = GetThickness();
375 
376  if( aDrawMode != UNSPECIFIED_DRAWMODE )
377  GRSetDrawMode( aDC, aDrawMode );
378 
379  if( aFillMode == SKETCH )
380  width = -width;
381 
382  wxSize size = GetTextSize();
383 
384  if( IsMirrored() )
385  size.x = -size.x;
386 
387  DrawGraphicText( aClipBox, aDC, aOffset + aPos, aColor, aText, GetTextAngle(), size,
389  width, IsItalic(), IsBold() );
390 }
391 
392 
394 {
395  int style = 0;
396 
397  if( IsItalic() )
398  style = 1;
399 
400  if( IsBold() )
401  style += 2;
402 
403  wxString stylemsg[4] = {
404  _("Normal"),
405  _("Italic"),
406  _("Bold"),
407  _("Bold+Italic")
408  };
409 
410  return stylemsg[style];
411 }
412 
413 
415 {
416  return ( GetTextWidth() == Mils2iu( DEFAULT_SIZE_TEXT )
417  && GetTextHeight() == Mils2iu( DEFAULT_SIZE_TEXT )
418  && IsVisible()
419  && !IsMirrored()
422  && GetThickness() == 0
423  && !IsItalic()
424  && !IsBold()
425  && !IsMultilineAllowed()
426  );
427 }
428 
429 
430 void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
431  throw( IO_ERROR )
432 {
433 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
434  // and does not define FMT_IU, used here
435  // however this function should exist
436  if( !IsDefaultFormatting() )
437  {
438  aFormatter->Print( aNestLevel+1, "(effects" );
439 
440  if( ( GetTextWidth() != Mils2iu( DEFAULT_SIZE_TEXT ) )
441  || ( GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) )
442  || ( GetThickness() != 0 ) || IsBold() || IsItalic() )
443  {
444  aFormatter->Print( 0, " (font" );
445 
446  // Add font support here at some point in the future.
447 
448  if( GetTextWidth() != Mils2iu( DEFAULT_SIZE_TEXT )
449  || GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) )
450  {
451  aFormatter->Print( 0, " (size %s %s)",
452  FMT_IU( GetTextHeight() ).c_str(),
453  FMT_IU( GetTextWidth() ).c_str()
454  );
455  }
456 
457  if( GetThickness() )
458  aFormatter->Print( 0, " (thickness %s)", FMT_IU( GetThickness() ).c_str() );
459 
460  if( IsBold() )
461  aFormatter->Print( 0, " bold" );
462 
463  if( IsItalic() )
464  aFormatter->Print( 0, " italic" );
465 
466  aFormatter->Print( 0, ")");
467  }
468 
469  if( IsMirrored() || ( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
470  || ( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER ) )
471  {
472  aFormatter->Print( 0, " (justify");
473 
474  if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
475  aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
476 
477  if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
478  aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
479 
480  if( IsMirrored() )
481  aFormatter->Print( 0, " mirror" );
482 
483  aFormatter->Print( 0, ")" );
484  }
485 
486  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
487  aFormatter->Print( 0, " hide" );
488 
489  aFormatter->Print( 0, ")\n" );
490  }
491 #endif
492 }
493 
494 // Convert the text shape to a list of segment
495 // each segment is stored as 2 wxPoints: its starting point and its ending point
496 // we are using DrawGraphicText to create the segments.
497 // and therefore a call-back function is needed
498 static std::vector<wxPoint>* s_cornerBuffer;
499 
500 // This is a call back function, used by DrawGraphicText to put each segment in buffer
501 static void addTextSegmToBuffer( int x0, int y0, int xf, int yf )
502 {
503  s_cornerBuffer->push_back( wxPoint( x0, y0 ) );
504  s_cornerBuffer->push_back( wxPoint( xf, yf ) );
505 }
506 
507 void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuffer ) const
508 {
509  wxSize size = GetTextSize();
510 
511  if( IsMirrored() )
512  size.x = -size.x;
513 
514  s_cornerBuffer = &aCornerBuffer;
515  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by DrawGraphicText
516 
517  if( IsMultilineAllowed() )
518  {
519  wxArrayString strings_list;
520  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
521  std::vector<wxPoint> positions;
522  positions.reserve( strings_list.Count() );
523  GetPositionsOfLinesOfMultilineText( positions,strings_list.Count() );
524 
525  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
526  {
527  wxString txt = strings_list.Item( ii );
528  DrawGraphicText( NULL, NULL, positions[ii], color,
529  txt, GetTextAngle(), size,
531  GetThickness(), IsItalic(),
532  true, addTextSegmToBuffer );
533  }
534  }
535  else
536  {
537  DrawGraphicText( NULL, NULL, GetTextPos(), color,
538  GetText(), GetTextAngle(), size,
540  GetThickness(), IsItalic(),
541  true, addTextSegmToBuffer );
542  }
543 }
EDA_TEXT(const wxString &text=wxEmptyString)
Definition: eda_text.cpp:54
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Function wxStringSplit splits aString to a string list separated at aSplitter.
Definition: common.cpp:137
void SetFontItalic(const bool aItalic)
Set italic property of current font.
int GetInterline(int aTextThickness=-1) const
Function GetInterline return the distance between 2 text lines has meaning only for multiline texts...
Definition: eda_text.cpp:107
static double GetInterline(double aGlyphHeight, double aGlyphThickness)
Compute the X and Y size of a given text.
void DrawGraphicText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, 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), PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
Definition: drawtxt.cpp:122
void SwapEffects(EDA_TEXT &aTradingPartner)
Function SwapEffects swaps the text effects of the two involved instances.
Definition: eda_text.cpp:74
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:74
bool IsMultilineAllowed() const
Definition: eda_text.h:188
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:92
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
bool IsItalic() const
Definition: eda_text.h:170
Base schematic object class definition.
Implementation of conversion functions that require both schematic and board internal units...
bool Contains(const wxPoint &aPoint) const
Function Contains.
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void SetEffects(const EDA_TEXT &aSrc)
Function SetEffects sets the text effects from another instance.
Definition: eda_text.cpp:68
TEXT_EFFECTS m_e
Definition: eda_text.h:370
int GetTextWidth() const
Definition: eda_text.h:218
void SetOrigin(const wxPoint &pos)
void GRDrawAnchor(EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor)
Definition: gr_basic.cpp:1259
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:214
static std::vector< wxPoint > * s_cornerBuffer
Definition: eda_text.cpp:498
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
Definition of base KiCad text object.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
VECTOR2D ComputeStringBoundaryLimits(const UTF8 &aText, VECTOR2D aGlyphSize, double aGlyphThickness, double *aTopLimit=NULL, double *aBottomLimit=NULL) const
Compute the boundary limits of aText (the bbox of all shapes).
double GetTextAngle() const
Definition: eda_text.h:164
bool IsBold() const
Definition: eda_text.h:173
void drawOneLineOfText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, const wxString &aText, const wxPoint &aPos)
Function drawOneLineOfText draws a single text line.
Definition: eda_text.cpp:369
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
This file contains miscellaneous commonly used macros and functions.
bool IsDefaultFormatting() const
Definition: eda_text.cpp:414
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:135
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:114
void SetFontBold(const bool aBold)
Set bold property of current font.
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false) const
Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones fi...
Definition: eda_text.cpp:115
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Function TextHitTest Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:267
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
virtual void Format(OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
Function Format outputs the object to aFormatter in s-expression form.
Definition: eda_text.cpp:430
EDA_DRAW_MODE_T
Definition: eda_text.h:62
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
#define FMT_IU
void GetPositionsOfLinesOfMultilineText(std::vector< wxPoint > &aPositions, int aLineCount) const
Function GetPositionsOfLinesOfMultilineText Populates aPositions with the position of each line of a ...
Definition: eda_text.cpp:327
void SetX(int val)
virtual ~EDA_TEXT()
Definition: eda_text.cpp:63
#define DIM_ANCRE_TEXTE
Definition: eda_text.h:75
void SetY(int val)
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
void SetSize(const wxSize &size)
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
wxString GetTextStyleName()
Function GetTextStyleName.
Definition: eda_text.cpp:393
#define max(a, b)
Definition: auxiliary.h:86
bool IsMirrored() const
Definition: eda_text.h:179
bool IsVisible() const
Definition: eda_text.h:176
void TransformTextShapeToSegmentList(std::vector< wxPoint > &aCornerBuffer) const
Convert the text shape to a list of segment each segment is stored as 2 wxPoints: the starting point ...
Definition: eda_text.cpp:507
Class EDA_RECT handles the component boundary box.
int GetX() const
double ComputeOverbarVerticalPosition(double aGlyphHeight, double aGlyphThickness) const
Compute the vertical position of an overbar, sometimes used in texts.
int GetWidth() const
int GetY() const
int GetTextHeight() const
Definition: eda_text.h:221
This file is part of the common libary.
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
BASIC_GAL basic_gal(basic_displayOptions)
Definition: colors.h:45
const STROKE_FONT & GetStrokeFont() const
const wxSize & GetTextSize() const
Definition: eda_text.h:215
int LenSize(const wxString &aLine) const
Function LenSize.
Definition: eda_text.cpp:80
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf)
Definition: eda_text.cpp:501
#define CTL_OMIT_HIDE
Definition: eda_text.h:42
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void Draw(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode=FILLED, COLOR4D aAnchor_color=COLOR4D::UNSPECIFIED)
Function Draw.
Definition: eda_text.cpp:292
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39