KiCad PCB EDA Suite
EDA_TEXT Class Reference

A mix-in class (via multiple inheritance) that handles texts such as labels, parts, components, or footprints. More...

#include <eda_text.h>

Inheritance diagram for EDA_TEXT:
DS_DRAW_ITEM_TEXT FP_TEXT LIB_FIELD LIB_TEXT PCB_TEXT SCH_FIELD SCH_TEXT SCH_GLOBALLABEL SCH_HIERLABEL SCH_LABEL SCH_SHEET_PIN

Public Member Functions

 EDA_TEXT (const wxString &text=wxEmptyString)
 
 EDA_TEXT (const EDA_TEXT &aText)
 
virtual ~EDA_TEXT ()
 
virtual const wxString & GetText () const
 Return the string associated with the text object. More...
 
virtual wxString GetShownText (int aDepth=0) const
 Return the string actually shown after processing of the base text. More...
 
wxString ShortenedShownText () const
 Returns a shortened version (max 15 characters) of the shown text. More...
 
bool HasTextVars () const
 Indicates the ShownText has text var references which need to be processed. More...
 
virtual void SetText (const wxString &aText)
 
void SetTextThickness (int aWidth)
 The TextThickness is that set by the user. More...
 
int GetTextThickness () const
 
int GetEffectiveTextPenWidth (int aDefaultWidth=0) const
 The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth. More...
 
virtual void SetTextAngle (double aAngle)
 
double GetTextAngle () const
 
double GetTextAngleDegrees () const
 
double GetTextAngleRadians () const
 
void SetItalic (bool isItalic)
 
bool IsItalic () const
 
void SetBold (bool aBold)
 
bool IsBold () const
 
virtual void SetVisible (bool aVisible)
 
virtual bool IsVisible () const
 
void SetMirrored (bool isMirrored)
 
bool IsMirrored () const
 
void SetMultilineAllowed (bool aAllow)
 
bool IsMultilineAllowed () const
 
EDA_TEXT_HJUSTIFY_T GetHorizJustify () const
 
EDA_TEXT_VJUSTIFY_T GetVertJustify () const
 
void SetHorizJustify (EDA_TEXT_HJUSTIFY_T aType)
 
void SetVertJustify (EDA_TEXT_VJUSTIFY_T aType)
 
void SetEffects (const EDA_TEXT &aSrc)
 Set the text effects from another instance. More...
 
void SwapEffects (EDA_TEXT &aTradingPartner)
 Swap the text effects of the two involved instances. More...
 
void SwapText (EDA_TEXT &aTradingPartner)
 
void CopyText (const EDA_TEXT &aSrc)
 
bool Replace (const wxFindReplaceData &aSearchData)
 Helper function used in search and replace dialog. More...
 
bool IsDefaultFormatting () const
 
void SetTextSize (const wxSize &aNewSize)
 
const wxSize & GetTextSize () const
 
void SetTextWidth (int aWidth)
 
int GetTextWidth () const
 
void SetTextHeight (int aHeight)
 
int GetTextHeight () const
 
void SetTextPos (const wxPoint &aPoint)
 
const wxPoint & GetTextPos () const
 
void SetTextX (int aX)
 
void SetTextY (int aY)
 
void Offset (const wxPoint &aOffset)
 
void Empty ()
 
void Print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
 Print this text object to the device context aDC. More...
 
std::vector< wxPoint > TransformToSegmentList () const
 Convert the text shape to a list of segment. More...
 
void TransformBoundingBoxWithClearanceToPolygon (SHAPE_POLY_SET *aCornerBuffer, int aClearanceValue) const
 Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical. More...
 
std::shared_ptr< SHAPE_COMPOUNDGetEffectiveTextShape () const
 
virtual bool TextHitTest (const wxPoint &aPoint, int aAccuracy=0) const
 Test if aPoint is within the bounds of this object. More...
 
virtual bool TextHitTest (const EDA_RECT &aRect, bool aContains, int aAccuracy=0) const
 Test if object bounding box is contained within or intersects aRect. More...
 
int LenSize (const wxString &aLine, int aThickness) const
 
EDA_RECT GetTextBox (int aLine=-1, bool aInvertY=false) const
 Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....) More...
 
int GetInterline () const
 Return the distance between two lines of text. More...
 
wxString GetTextStyleName () const
 
void GetLinePositions (std::vector< wxPoint > &aPositions, int aLineCount) const
 Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text. More...
 
virtual void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
 Output the object to aFormatter in s-expression form. More...
 
virtual double GetDrawRotation () const
 
virtual wxPoint GetDrawPos () const
 
virtual EDA_TEXT_HJUSTIFY_T GetDrawHorizJustify () const
 
virtual EDA_TEXT_VJUSTIFY_T GetDrawVertJustify () const
 
int Compare (const EDA_TEXT *aOther) const
 

Static Public Member Functions

static EDA_TEXT_HJUSTIFY_T MapHorizJustify (int aHorizJustify)
 
static EDA_TEXT_VJUSTIFY_T MapVertJustify (int aVertJustify)
 

Private Types

enum  TE_FLAGS {
  TE_MIRROR, TE_ITALIC, TE_BOLD, TE_MULTILINE,
  TE_VISIBLE
}
 

Private Member Functions

void cacheShownText ()
 
void printOneLineOfText (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const wxPoint &aPos)
 Print each line of this EDA_TEXT. More...
 

Private Attributes

wxString m_text
 
wxString m_shown_text
 
bool m_shown_text_has_text_var_refs
 
TEXT_EFFECTS m_e
 

Detailed Description

A mix-in class (via multiple inheritance) that handles texts such as labels, parts, components, or footprints.

Because it's a mix-in class, care is used to provide function names (accessors) that to not collide with function names likely to be seen in the combined derived classes.

Definition at line 140 of file eda_text.h.

Member Enumeration Documentation

◆ TE_FLAGS

enum EDA_TEXT::TE_FLAGS
private
Enumerator
TE_MIRROR 
TE_ITALIC 
TE_BOLD 
TE_MULTILINE 
TE_VISIBLE 

Definition at line 417 of file eda_text.h.

Constructor & Destructor Documentation

◆ EDA_TEXT() [1/2]

EDA_TEXT::EDA_TEXT ( const wxString &  text = wxEmptyString)

Definition at line 101 of file eda_text.cpp.

101  :
102  m_text( text ),
103  m_e( 1 << TE_VISIBLE )
104 {
105  int sz = Mils2iu( DEFAULT_SIZE_TEXT );
106  SetTextSize( wxSize( sz, sz ) );
107  cacheShownText();
108 }
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:101
TEXT_EFFECTS m_e
Definition: eda_text.h:415
void cacheShownText()
Definition: eda_text.cpp:189
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:258
wxString m_text
Definition: eda_text.h:411

References cacheShownText(), DEFAULT_SIZE_TEXT, and SetTextSize().

◆ EDA_TEXT() [2/2]

EDA_TEXT::EDA_TEXT ( const EDA_TEXT aText)

Definition at line 111 of file eda_text.cpp.

111  :
112  m_text( aText.m_text ),
113  m_e( aText.m_e )
114 {
115  cacheShownText();
116 }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
void cacheShownText()
Definition: eda_text.cpp:189
wxString m_text
Definition: eda_text.h:411

References cacheShownText().

◆ ~EDA_TEXT()

EDA_TEXT::~EDA_TEXT ( )
virtual

Definition at line 119 of file eda_text.cpp.

120 {
121 }

Member Function Documentation

◆ cacheShownText()

void EDA_TEXT::cacheShownText ( )
private

Definition at line 189 of file eda_text.cpp.

190 {
191  if( m_text.IsEmpty() )
192  {
193  m_shown_text = wxEmptyString;
195  }
196  else
197  {
199  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
200  }
201 }
wxString m_shown_text
Definition: eda_text.h:412
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:413
wxString m_text
Definition: eda_text.h:411
wxString UnescapeString(const wxString &aSource)

References m_shown_text, m_shown_text_has_text_var_refs, m_text, and UnescapeString().

Referenced by EDA_TEXT(), Replace(), and SetText().

◆ Compare()

int EDA_TEXT::Compare ( const EDA_TEXT aOther) const

Definition at line 659 of file eda_text.cpp.

660 {
661 #define EPSILON 2 // Should be enough for rounding errors on calculated items
662 
663 #define TEST( a, b ) { if( a != b ) return a - b; }
664 #define TEST_E( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; }
665 #define TEST_PT( a, b ) { TEST_E( a.x, b.x ); TEST_E( a.y, b.y ); }
666 
667  TEST_PT( m_e.pos, aOther->m_e.pos );
668 
669  TEST_PT( m_e.size, aOther->m_e.size );
670  TEST_E( m_e.penwidth, aOther->m_e.penwidth );
671  TEST( m_e.angle, aOther->m_e.angle );
672 
673  TEST( m_e.hjustify, aOther->m_e.hjustify );
674  TEST( m_e.vjustify, aOther->m_e.vjustify );
675  TEST( m_e.bits, aOther->m_e.bits );
676 
677  return m_text.Cmp( aOther->m_text );
678 }
#define TEST(a, b)
TEXT_EFFECTS m_e
Definition: eda_text.h:415
signed char vjustify
vertical justification
Definition: eda_text.h:123
#define TEST_PT(a, b)
wxPoint pos
Definition: eda_text.h:127
wxSize size
Definition: eda_text.h:124
#define TEST_E(a, b)
wxString m_text
Definition: eda_text.h:411
int bits
any set of booleans a client uses.
Definition: eda_text.h:121
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:126
signed char hjustify
horizontal justification
Definition: eda_text.h:122
int penwidth
Definition: eda_text.h:125

References TEXT_EFFECTS::angle, TEXT_EFFECTS::bits, TEXT_EFFECTS::hjustify, m_e, m_text, TEXT_EFFECTS::penwidth, TEXT_EFFECTS::pos, TEXT_EFFECTS::size, TEST, TEST_E, TEST_PT, and TEXT_EFFECTS::vjustify.

◆ CopyText()

void EDA_TEXT::CopyText ( const EDA_TEXT aSrc)

Definition at line 131 of file eda_text.cpp.

132 {
133  m_text = aSrc.m_text;
134  m_shown_text = aSrc.m_shown_text;
136 }
wxString m_shown_text
Definition: eda_text.h:412
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:413
wxString m_text
Definition: eda_text.h:411

References m_shown_text, m_shown_text_has_text_var_refs, and m_text.

Referenced by LIB_FIELD::Copy(), and CLIPBOARD_IO::SaveSelection().

◆ Empty()

void EDA_TEXT::Empty ( )
inline

Definition at line 275 of file eda_text.h.

275 { m_text.Empty(); }
wxString m_text
Definition: eda_text.h:411

References m_text.

Referenced by SCH_LEGACY_PLUGIN_CACHE::LoadPart().

◆ Format()

void EDA_TEXT::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
virtual

Output the object to aFormatter in s-expression form.

Parameters
aFormatterThe OUTPUTFORMATTER object to write to.
aNestLevelThe indentation next level.
aControlBitsThe control bit definition for object specific formatting.
Exceptions
IO_ERRORon write error.

Definition at line 539 of file eda_text.cpp.

540 {
541 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
542  // and does not define FormatInternalUnits, used here
543  // however this function should exist
544 
545  aFormatter->Print( aNestLevel + 1, "(effects" );
546 
547  // Text size
548  aFormatter->Print( 0, " (font" );
549 
550  aFormatter->Print( 0, " (size %s %s)",
551  FormatInternalUnits( GetTextHeight() ).c_str(),
552  FormatInternalUnits( GetTextWidth() ).c_str() );
553 
554  if( GetTextThickness() )
555  {
556  aFormatter->Print( 0, " (thickness %s)",
557  FormatInternalUnits( GetTextThickness() ).c_str() );
558  }
559 
560  if( IsBold() )
561  aFormatter->Print( 0, " bold" );
562 
563  if( IsItalic() )
564  aFormatter->Print( 0, " italic" );
565 
566  aFormatter->Print( 0, ")"); // (font
567 
570  {
571  aFormatter->Print( 0, " (justify");
572 
574  aFormatter->Print( 0, GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ? " left" : " right" );
575 
577  aFormatter->Print( 0, GetVertJustify() == GR_TEXT_VJUSTIFY_TOP ? " top" : " bottom" );
578 
579  if( IsMirrored() )
580  aFormatter->Print( 0, " mirror" );
581 
582  aFormatter->Print( 0, ")" ); // (justify
583  }
584 
585  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
586  aFormatter->Print( 0, " hide" );
587 
588  aFormatter->Print( 0, ")\n" ); // (justify
589 
590 #endif
591 }
bool IsBold() const
Definition: eda_text.h:204
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
int GetTextThickness() const
Definition: eda_text.h:181
int GetTextHeight() const
Definition: eda_text.h:265
bool IsItalic() const
Definition: eda_text.h:201
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
virtual bool IsVisible() const
Definition: eda_text.h:207
int GetTextWidth() const
Definition: eda_text.h:262
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
#define CTL_OMIT_HIDE
Definition: eda_text.h:77
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:480

References CTL_OMIT_HIDE, FormatInternalUnits(), GetHorizJustify(), GetTextHeight(), GetTextThickness(), GetTextWidth(), GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, IsBold(), IsItalic(), IsMirrored(), IsVisible(), and OUTPUTFORMATTER::Print().

Referenced by SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveText(), and SCH_SEXPR_PLUGIN_CACHE::saveText().

◆ GetDrawHorizJustify()

virtual EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetDrawHorizJustify ( ) const
inlinevirtual

Reimplemented in SCH_FIELD.

Definition at line 390 of file eda_text.h.

390 { return GetHorizJustify(); };
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219

References GetHorizJustify().

Referenced by TransformToSegmentList().

◆ GetDrawPos()

virtual wxPoint EDA_TEXT::GetDrawPos ( ) const
inlinevirtual

Reimplemented in SCH_FIELD.

Definition at line 389 of file eda_text.h.

389 { return GetTextPos(); }
const wxPoint & GetTextPos() const
Definition: eda_text.h:268

References GetTextPos().

Referenced by TransformToSegmentList().

◆ GetDrawRotation()

virtual double EDA_TEXT::GetDrawRotation ( ) const
inlinevirtual

Reimplemented in FP_TEXT, and SCH_FIELD.

Definition at line 388 of file eda_text.h.

388 { return GetTextAngle(); }
double GetTextAngle() const
Definition: eda_text.h:195

References GetTextAngle().

Referenced by TransformToSegmentList().

◆ GetDrawVertJustify()

virtual EDA_TEXT_VJUSTIFY_T EDA_TEXT::GetDrawVertJustify ( ) const
inlinevirtual

Reimplemented in SCH_FIELD.

Definition at line 391 of file eda_text.h.

391 { return GetVertJustify(); };
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220

References GetVertJustify().

Referenced by TransformToSegmentList().

◆ GetEffectiveTextPenWidth()

int EDA_TEXT::GetEffectiveTextPenWidth ( int  aDefaultWidth = 0) const

The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.

Definition at line 159 of file eda_text.cpp.

160 {
161  int width = GetTextThickness();
162 
163  if( width <= 1 )
164  {
165  width = aDefaultWidth;
166 
167  if( IsBold() )
168  width = GetPenSizeForBold( GetTextWidth() );
169  else if( width <= 1 )
170  width = GetPenSizeForNormal( GetTextWidth() );
171  }
172 
173  // Clip pen size for small texts:
175 
176  return width;
177 }
bool IsBold() const
Definition: eda_text.h:204
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:46
int GetTextThickness() const
Definition: eda_text.h:181
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:67
const wxSize & GetTextSize() const
Definition: eda_text.h:259
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:52
#define ALLOW_BOLD_THICKNESS
Definition: base_units.h:56
int GetTextWidth() const
Definition: eda_text.h:262

References ALLOW_BOLD_THICKNESS, Clamp_Text_PenSize(), GetPenSizeForBold(), GetPenSizeForNormal(), GetTextSize(), GetTextThickness(), GetTextWidth(), and IsBold().

Referenced by BOARD_ADAPTER::addShapeWithClearance(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), SCH_HIERLABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBoxBase(), GetEffectiveTextShape(), LIB_TEXT::GetPenWidth(), LIB_FIELD::GetPenWidth(), SCH_FIELD::GetPenWidth(), SCH_TEXT::GetPenWidth(), GetTextBox(), KIGFX::SCH_PAINTER::getTextThickness(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_TEXT::print(), SCH_FIELD::Print(), printOneLineOfText(), PNS_KICAD_IFACE_BASE::syncTextItem(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_ORTHOGONAL::updateText().

◆ GetEffectiveTextShape()

std::shared_ptr< SHAPE_COMPOUND > EDA_TEXT::GetEffectiveTextShape ( ) const

Definition at line 646 of file eda_text.cpp.

647 {
648  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
649  int penWidth = GetEffectiveTextPenWidth();
650  std::vector<wxPoint> pts = TransformToSegmentList();
651 
652  for( unsigned jj = 0; jj < pts.size(); jj += 2 )
653  shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
654 
655  return shape;
656 }
std::vector< wxPoint > TransformToSegmentList() const
Convert the text shape to a list of segment.
Definition: eda_text.cpp:606
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159

References GetEffectiveTextPenWidth(), and TransformToSegmentList().

Referenced by PCB_TEXT::GetEffectiveShape(), and FP_TEXT::GetEffectiveShape().

◆ GetHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetHorizJustify ( ) const
inline

Definition at line 219 of file eda_text.h.

219 { return EDA_TEXT_HJUSTIFY_T( m_e.hjustify ); };
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:82
TEXT_EFFECTS m_e
Definition: eda_text.h:415
signed char hjustify
horizontal justification
Definition: eda_text.h:122

References TEXT_EFFECTS::hjustify, and m_e.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), EDA_TEXT_DESC::EDA_TEXT_DESC(), AUTOPLACER::fieldHPlacement(), Format(), GetDrawHorizJustify(), SCH_FIELD::GetEffectiveHorizJustify(), LIB_TEXT::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), GetTextBox(), IsDefaultFormatting(), SCH_FIELD::IsHorizJustifyFlipped(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), positioningChanged(), LIB_FIELD::print(), printOneLineOfText(), LIB_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), KIGFX::GAL::SetTextAttributes(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and FP_TEXT::TransformTextShapeWithClearanceToPolygon().

◆ GetInterline()

int EDA_TEXT::GetInterline ( ) const

Return the distance between two lines of text.

Calculates the distance (pitch) between two lines of text. This distance includes the interline distance plus room for characters like j, {, and [. It also used for single line text, to calculate the text bounding box.

Definition at line 233 of file eda_text.cpp.

234 {
236 }
static double GetInterline(double aGlyphHeight)
Compute the distance (interline) between 2 lines of text (for multiline texts).
int GetTextHeight() const
Definition: eda_text.h:265
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References KIGFX::STROKE_FONT::GetInterline(), GetTextHeight(), and KiROUND().

Referenced by CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), and GetLinePositions().

◆ GetLinePositions()

void EDA_TEXT::GetLinePositions ( std::vector< wxPoint > &  aPositions,
int  aLineCount 
) const

Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text.

Parameters
aPositionsis the list to populate by the wxPoint positions.
aLineCountis the number of lines (not recalculated here for efficiency reasons.

Definition at line 443 of file eda_text.cpp.

444 {
445  wxPoint pos = GetTextPos(); // Position of first line of the
446  // multiline text according to
447  // the center of the multiline text block
448 
449  wxPoint offset; // Offset to next line.
450 
451  offset.y = GetInterline();
452 
453  if( aLineCount > 1 )
454  {
455  switch( GetVertJustify() )
456  {
458  break;
459 
461  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
462  break;
463 
465  pos.y -= ( aLineCount - 1 ) * offset.y;
466  break;
467  }
468  }
469 
470  // Rotate the position of the first line
471  // around the center of the multiline text block
472  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
473 
474  // Rotate the offset lines to increase happened in the right direction
475  RotatePoint( &offset, GetTextAngle() );
476 
477  for( int ii = 0; ii < aLineCount; ii++ )
478  {
479  aPositions.push_back( pos );
480  pos += offset;
481  }
482 }
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:233
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
double GetTextAngle() const
Definition: eda_text.h:195
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
const wxPoint & GetTextPos() const
Definition: eda_text.h:268

References GetInterline(), GetTextAngle(), GetTextPos(), GetVertJustify(), GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, and RotatePoint().

Referenced by SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), Print(), and TransformToSegmentList().

◆ GetShownText()

virtual wxString EDA_TEXT::GetShownText ( int  aDepth = 0) const
inlinevirtual

Return the string actually shown after processing of the base text.

Parameters
aDepthis used to prevent infinite recursions and loops when expanding text variables.

Reimplemented in FP_TEXT, SCH_TEXT, SCH_FIELD, and PCB_TEXT.

Definition at line 162 of file eda_text.h.

162 { return m_shown_text; }
wxString m_shown_text
Definition: eda_text.h:412

References m_shown_text.

Referenced by KIGFX::DS_PAINTER::draw(), DS_DRAW_ITEM_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), FP_TEXT::GetShownText(), GetTextBox(), LIB_FIELD::Plot(), LIB_SYMBOL::PlotLibFields(), LIB_TEXT::print(), Print(), ShortenedShownText(), and TransformToSegmentList().

◆ GetText()

virtual const wxString& EDA_TEXT::GetText ( ) const
inlinevirtual

Return the string associated with the text object.

Returns
a const wxString reference containing the string of the item.

Definition at line 154 of file eda_text.h.

154 { return m_text; }
wxString m_text
Definition: eda_text.h:411

References m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), NETLIST_EXPORTER_XML::addSymbolFields(), SIM_PLOT_FRAME::AddTuner(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CONNECTION_GRAPH::buildConnectionGraph(), LIB_TEXT::Clone(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), KIGFX::SCH_VIEW::DisplaySymbol(), SCH_FIELD::DoHypertextMenu(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CONNECTION_GRAPH::ercCheckHierSheets(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), LIB_SYMBOL::Flatten(), PCB_PLUGIN::format(), FormatProbeItem(), SCH_SYMBOL::GetFootprint(), LIB_FIELD::GetFullText(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), FP_TEXT::GetLength(), getMatchingTextItem(), PCB_TEXT::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_SYMBOL::GetRef(), FOOTPRINT::GetReference(), LIB_SYMBOL::GetSearchText(), PCB_DIMENSION_BASE::GetText(), FOOTPRINT::GetValue(), SCH_SYMBOL::GetValue(), LIB_FIELD::HitTest(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_TEXT::IncrementLabel(), GENERAL_COLLECTOR::Inspect(), SCH_FIELD::IsVoid(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSegments(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), SCH_TEXT::operator<(), SCH_FIELD::operator<(), LIB_FIELD::operator=(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceText(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), DIALOG_RESCUE_EACH::PopulateInstanceList(), LIB_FIELD::print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_EDIT_FRAME::RecomputeIntersheetRefs(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_SEXPR_PLUGIN::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SYMBOL_VIEWER_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_SHEET::SymbolCount(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), TransformBoundingBoxWithClearanceToPolygon(), TUNER_SLIDER::TUNER_SLIDER(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo(), and FP_TEXT::ViewGetLOD().

◆ GetTextAngle()

double EDA_TEXT::GetTextAngle ( ) const
inline

Definition at line 195 of file eda_text.h.

195 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:126

References TEXT_EFFECTS::angle, and m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOARD_ADAPTER::addShapeWithClearance(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), PCB_TEXT::Flip(), FP_TEXT::Flip(), PCB_PLUGIN::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_FIELD::GetDrawRotation(), FP_TEXT::GetDrawRotation(), GetDrawRotation(), GetLinePositions(), GetTextAngleDegrees(), GetTextAngleRadians(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), ALTIUM_PCB::ParseTexts6Data(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), positioningChanged(), LIB_TEXT::print(), SCH_FIELD::Print(), LIB_FIELD::print(), printOneLineOfText(), SCH_EDIT_TOOL::Rotate(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), LIB_FIELD::Rotate(), PCB_DIMENSION_BASE::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), TextHitTest(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), TransformBoundingBoxWithClearanceToPolygon(), FP_TEXT::TransformShapeWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ GetTextAngleDegrees()

double EDA_TEXT::GetTextAngleDegrees ( ) const
inline

◆ GetTextAngleRadians()

double EDA_TEXT::GetTextAngleRadians ( ) const
inline

◆ GetTextBox()

EDA_RECT EDA_TEXT::GetTextBox ( int  aLine = -1,
bool  aInvertY = false 
) const

Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....)

Parameters
aLineThe line of text to consider. Pass -1 for all lines.
aInvertYInvert the Y axis when calculating bounding box.
Returns
the rect containing the line of text (i.e. the position and the size of one line) this rectangle is calculated for 0 orient text. If orientation is not 0 the rect must be rotated to match the physical area

Definition at line 239 of file eda_text.cpp.

240 {
241  EDA_RECT rect;
242  wxArrayString strings;
243  wxString text = GetShownText();
244  int thickness = GetEffectiveTextPenWidth();
245  int linecount = 1;
246  bool hasOverBar = false; // true if the first line of text as an overbar
247 
248  if( IsMultilineAllowed() )
249  {
250  wxStringSplit( text, strings, '\n' );
251 
252  if( strings.GetCount() ) // GetCount() == 0 for void strings
253  {
254  if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
255  text = strings.Item( aLine );
256  else
257  text = strings.Item( 0 );
258 
259  linecount = strings.GetCount();
260  }
261  }
262 
263  // Search for overbar symbol. Only text is scanned,
264  // because only this line can change the bounding box
265  for( unsigned ii = 1; ii < text.size(); ii++ )
266  {
267  if( text[ii-1] == '~' && text[ii] == '{' )
268  {
269  hasOverBar = true;
270  break;
271  }
272  }
273 
274  // calculate the H and V size
275  const auto& font = basic_gal.GetStrokeFont();
276  VECTOR2D fontSize( GetTextSize() );
277  double penWidth( thickness );
278  VECTOR2D extents = font.ComputeStringBoundaryLimits( text, fontSize, penWidth );
279  double interline = KIGFX::STROKE_FONT::GetInterline( fontSize.y );
280 
281  // Creates bounding box (rectangle) for horizontal, left and top justified text. The
282  // bounding box will be moved later according to the actual text options
283  wxSize textsize = wxSize( KiROUND( extents.x ), KiROUND( extents.y ) );
284  wxPoint pos = GetTextPos();
285 
286  if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
287  pos.y -= KiROUND( aLine * interline );
288 
289  if( aInvertY )
290  pos.y = -pos.y;
291 
292  rect.SetOrigin( pos );
293 
294  if( hasOverBar )
295  { // A overbar adds an extra size to the text
296  // Height from the base line text of chars like [ or {
297  double curr_height = GetTextHeight() * 1.15;
298  double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
299  int extra_height = KiROUND( overbarPosition - curr_height );
300 
301  extra_height += thickness / 2;
302  textsize.y += extra_height;
303  rect.Move( wxPoint( 0, -extra_height ) );
304  }
305 
306  // for multiline texts and aLine < 0, merge all rectangles
307  // ( if aLine < 0, we want the full text bounding box )
308  if( IsMultilineAllowed() && aLine < 0 )
309  {
310  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
311  {
312  text = strings.Item( ii );
313  extents = font.ComputeStringBoundaryLimits( text, fontSize, penWidth );
314  textsize.x = std::max( textsize.x, KiROUND( extents.x ) );
315  }
316 
317  // interline spacing is only *between* lines, so total height is the height of the first
318  // line plus the interline distance (with interline spacing) for all subsequent lines
319  // Don't add interline spacing to empty textboxes
320  if( strings.GetCount() )
321  textsize.y += KiROUND( ( strings.GetCount() - 1 ) * interline );
322  }
323 
324  rect.SetSize( textsize );
325 
326  /* Now, calculate the rect origin, according to text justification
327  * At this point the rectangle origin is the text origin (m_Pos).
328  * This is true only for left and top text justified texts (using top to bottom Y axis
329  * orientation). and must be recalculated for others justifications
330  * also, note the V justification is relative to the first line
331  */
332  switch( GetHorizJustify() )
333  {
335  if( IsMirrored() )
336  rect.SetX( rect.GetX() - rect.GetWidth() );
337  break;
338 
340  rect.SetX( rect.GetX() - ( rect.GetWidth() / 2 ) );
341  break;
342 
344  if( !IsMirrored() )
345  rect.SetX( rect.GetX() - rect.GetWidth() );
346  break;
347  }
348 
349  switch( GetVertJustify() )
350  {
352  break;
353 
355  rect.SetY( rect.GetY() - KiROUND( interline / 2.0 ) );
356  break;
357 
359  rect.SetY( rect.GetY() - KiROUND( interline ) );
360  break;
361  }
362 
363  if( linecount > 1 )
364  {
365  int yoffset;
366  linecount -= 1;
367 
368  switch( GetVertJustify() )
369  {
371  break;
372 
374  yoffset = KiROUND( linecount * interline / 2.0 );
375  rect.SetY( rect.GetY() - yoffset );
376  break;
377 
379  yoffset = KiROUND( linecount * interline );
380  rect.SetY( rect.GetY() - yoffset );
381  break;
382  }
383  }
384 
385  // Many fonts draw diacriticals, descenders, etc. outside the X-height of the font. This
386  // will cacth most (but probably not all) of them.
387  rect.Inflate( 0, KiROUND( thickness * 0.75 ) );
388 
389  rect.Normalize(); // Make h and v sizes always >= 0
390 
391  return rect;
392 }
const STROKE_FONT & GetStrokeFont() const
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: eda_rect.cpp:51
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
static double GetInterline(double aGlyphHeight)
Compute the distance (interline) between 2 lines of text (for multiline texts).
int GetX() const
Definition: eda_rect.h:107
int GetWidth() const
Definition: eda_rect.h:118
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:130
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetTextHeight() const
Definition: eda_text.h:265
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
const wxSize & GetTextSize() const
Definition: eda_text.h:259
void SetX(int val)
Definition: eda_rect.h:167
bool IsMultilineAllowed() const
Definition: eda_text.h:217
void SetY(int val)
Definition: eda_rect.h:173
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void SetSize(const wxSize &size)
Definition: eda_rect.h:143
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:108
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
BASIC_GAL basic_gal(basic_displayOptions)
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References basic_gal, GetEffectiveTextPenWidth(), GetHorizJustify(), KIGFX::STROKE_FONT::GetInterline(), GetShownText(), KIGFX::GAL::GetStrokeFont(), GetTextHeight(), GetTextPos(), GetTextSize(), GetVertJustify(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, EDA_RECT::Inflate(), IsMirrored(), IsMultilineAllowed(), KiROUND(), EDA_RECT::Move(), EDA_RECT::Normalize(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), EDA_RECT::SetX(), EDA_RECT::SetY(), text, wxStringSplit(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), PCB_DIMENSION_BASE::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), DS_DRAW_ITEM_TEXT::GetBoundingBox(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), LIB_TEXT::NormalizeJustification(), FP_TEXT::TextHitTest(), TextHitTest(), TransformBoundingBoxWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and FP_TEXT::ViewBBox().

◆ GetTextHeight()

◆ GetTextPos()

const wxPoint& EDA_TEXT::GetTextPos ( ) const
inline

Definition at line 268 of file eda_text.h.

268 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
wxPoint pos
Definition: eda_text.h:127

References m_e, and TEXT_EFFECTS::pos.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), SCH_LABEL::doIsConnected(), SCH_GLOBALLABEL::doIsConnected(), SCH_HIERLABEL::doIsConnected(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), PCB_TEXT::Flip(), FP_TEXT::Flip(), PCB_PLUGIN::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBoxBase(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), GetDrawPos(), SCH_SHEET_PIN::GetEndPoints(), SCH_TEXT::GetEndPoints(), SCH_FIELD::GetLibPosition(), GetLinePositions(), PCB_TEXT::GetPosition(), FP_TEXT::GetPosition(), LIB_TEXT::GetPosition(), LIB_FIELD::GetPosition(), SCH_FIELD::GetPosition(), SCH_TEXT::GetPosition(), DS_DRAW_ITEM_TEXT::GetPosition(), GetTextBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), FP_TEXT::Mirror(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_FIELD::MirrorHorizontal(), SCH_SHEET_PIN::MirrorHorizontally(), SCH_TEXT::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_FIELD::MirrorVertical(), SCH_SHEET_PIN::MirrorVertically(), SCH_TEXT::MirrorVertically(), SCH_GLOBALLABEL::MirrorVertically(), LIB_TEXT::NormalizeJustification(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DRAWING_TOOL::PlaceText(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_FIELD::print(), Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), LIB_FIELD::Rotate(), SCH_SHEET_PIN::Rotate(), SCH_TEXT::Rotate(), PCB_DIMENSION_BASE::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), FP_TEXT::SetDrawCoord(), FP_TEXT::SetLocalCoord(), FP_TEXT::TextHitTest(), TextHitTest(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), TransformBoundingBoxWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), SCH_TEXT::UpdateDanglingState(), and FP_TEXT::ViewBBox().

◆ GetTextSize()

◆ GetTextStyleName()

wxString EDA_TEXT::GetTextStyleName ( ) const
Returns
a wxString with the style name( Normal, Italic, Bold, Bold+Italic).

Definition at line 504 of file eda_text.cpp.

505 {
506  int style = 0;
507 
508  if( IsItalic() )
509  style = 1;
510 
511  if( IsBold() )
512  style += 2;
513 
514  wxString stylemsg[4] = {
515  _("Normal"),
516  _("Italic"),
517  _("Bold"),
518  _("Bold+Italic")
519  };
520 
521  return stylemsg[style];
522 }
bool IsBold() const
Definition: eda_text.h:204
bool IsItalic() const
Definition: eda_text.h:201
#define _(s)

References _, IsBold(), and IsItalic().

Referenced by LIB_TEXT::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), and SCH_FIELD::GetMsgPanelInfo().

◆ GetTextThickness()

◆ GetTextWidth()

◆ GetVertJustify()

◆ HasTextVars()

bool EDA_TEXT::HasTextVars ( ) const
inline

Indicates the ShownText has text var references which need to be processed.

Definition at line 172 of file eda_text.h.

bool m_shown_text_has_text_var_refs
Definition: eda_text.h:413

References m_shown_text_has_text_var_refs.

Referenced by PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), and FP_TEXT::GetShownText().

◆ IsBold()

◆ IsDefaultFormatting()

bool EDA_TEXT::IsDefaultFormatting ( ) const

Definition at line 525 of file eda_text.cpp.

526 {
527  return ( IsVisible()
528  && !IsMirrored()
531  && GetTextThickness() == 0
532  && !IsItalic()
533  && !IsBold()
534  && !IsMultilineAllowed()
535  );
536 }
bool IsBold() const
Definition: eda_text.h:204
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
int GetTextThickness() const
Definition: eda_text.h:181
bool IsItalic() const
Definition: eda_text.h:201
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
virtual bool IsVisible() const
Definition: eda_text.h:207
bool IsMultilineAllowed() const
Definition: eda_text.h:217

References GetHorizJustify(), GetTextThickness(), GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, IsBold(), IsItalic(), IsMirrored(), IsMultilineAllowed(), and IsVisible().

Referenced by SCH_SEXPR_PLUGIN::saveField().

◆ IsItalic()

◆ IsMirrored()

◆ IsMultilineAllowed()

bool EDA_TEXT::IsMultilineAllowed ( ) const
inline

◆ IsVisible()

◆ LenSize()

int EDA_TEXT::LenSize ( const wxString &  aLine,
int  aThickness 
) const
Returns
the text length in internal units.
Parameters
aLinethe line of text to consider. For single line text, this parameter is always m_Text.
aThicknessthe stroke width of the text.

Definition at line 204 of file eda_text.cpp.

205 {
208  basic_gal.SetFontUnderlined( false );
209  basic_gal.SetLineWidth( (float) aThickness );
211 
212  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
213 
214  return KiROUND( tsize.x );
215 }
bool IsBold() const
Definition: eda_text.h:204
void SetFontBold(bool aBold)
Set bold property of current font.
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:201
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
const wxSize & GetTextSize() const
Definition: eda_text.h:259
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
BASIC_GAL basic_gal(basic_displayOptions)

References basic_gal, KIGFX::GAL::GetTextLineSize(), GetTextSize(), IsBold(), IsItalic(), KiROUND(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetLineWidth(), and VECTOR2< T >::x.

Referenced by SCH_GLOBALLABEL::CreateGraphicShape(), SCH_HIERLABEL::GetBoundingBox(), and SCH_GLOBALLABEL::GetBoundingBoxBase().

◆ MapHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
static

Definition at line 73 of file eda_text.cpp.

74 {
75  wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
76 
77  if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
79 
80  if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
81  return GR_TEXT_HJUSTIFY_LEFT;
82 
83  return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
84 }

References GR_TEXT_HJUSTIFY_LEFT, and GR_TEXT_HJUSTIFY_RIGHT.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ MapVertJustify()

EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
static

Definition at line 87 of file eda_text.cpp.

88 {
89  wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
90 
91  if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
93 
94  if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
95  return GR_TEXT_VJUSTIFY_TOP;
96 
97  return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
98 }

References GR_TEXT_VJUSTIFY_BOTTOM, and GR_TEXT_VJUSTIFY_TOP.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ Offset()

◆ Print()

void EDA_TEXT::Print ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset,
const COLOR4D aColor,
OUTLINE_MODE  aDisplay_mode = FILLED 
)

Print this text object to the device context aDC.

Parameters
aDCthe current Device Context.
aOffsetdraw offset (usually (0,0)).
aColortext color.
aDisplay_modeFILLED or SKETCH.

Definition at line 420 of file eda_text.cpp.

422 {
423  if( IsMultilineAllowed() )
424  {
425  std::vector<wxPoint> positions;
426  wxArrayString strings;
427  wxStringSplit( GetShownText(), strings, '\n' );
428 
429  positions.reserve( strings.Count() );
430 
431  GetLinePositions( positions, strings.Count() );
432 
433  for( unsigned ii = 0; ii < strings.Count(); ii++ )
434  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
435  }
436  else
437  {
438  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
439  }
440 }
void printOneLineOfText(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const wxPoint &aPos)
Print each line of this EDA_TEXT.
Definition: eda_text.cpp:484
bool IsMultilineAllowed() const
Definition: eda_text.h:217
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:443
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162

References GetLinePositions(), GetShownText(), GetTextPos(), IsMultilineAllowed(), printOneLineOfText(), and wxStringSplit().

Referenced by SCH_TEXT::Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), and DS_DRAW_ITEM_TEXT::PrintWsItem().

◆ printOneLineOfText()

void EDA_TEXT::printOneLineOfText ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset,
const COLOR4D aColor,
OUTLINE_MODE  aFillMode,
const wxString &  aText,
const wxPoint &  aPos 
)
private

Print each line of this EDA_TEXT.

Parameters
aOffsetdraw offset (usually (0,0)).
aColortext color.
aFillModeFILLED or SKETCH
aTextthe single line of text to draw.
aPosthe position of this line ).

Definition at line 484 of file eda_text.cpp.

487 {
488  wxDC* DC = aSettings->GetPrintDC();
489  int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
490 
491  if( aFillMode == SKETCH )
492  penWidth = -penWidth;
493 
494  wxSize size = GetTextSize();
495 
496  if( IsMirrored() )
497  size.x = -size.x;
498 
499  GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
500  GetVertJustify(), penWidth, IsItalic(), IsBold() );
501 }
bool IsBold() const
Definition: eda_text.h:204
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
double GetTextAngle() const
Definition: eda_text.h:195
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), void *aCallbackData, PLOTTER *aPlotter)
Draw a graphic text (like footprint texts).
Definition: gr_text.cpp:129
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
bool IsItalic() const
Definition: eda_text.h:201
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
const wxSize & GetTextSize() const
Definition: eda_text.h:259
wxDC * GetPrintDC() const
int GetDefaultPenWidth() const

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), GetEffectiveTextPenWidth(), GetHorizJustify(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GetTextAngle(), GetTextSize(), GetVertJustify(), GRText(), IsBold(), IsItalic(), IsMirrored(), and SKETCH.

Referenced by Print().

◆ Replace()

bool EDA_TEXT::Replace ( const wxFindReplaceData &  aSearchData)

Helper function used in search and replace dialog.

Perform a text replace using the find and replace criteria in aSearchData.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
Returns
True if the text item was modified, otherwise false.

Definition at line 180 of file eda_text.cpp.

181 {
182  bool retval = EDA_ITEM::Replace( aSearchData, m_text );
183  cacheShownText();
184 
185  return retval;
186 }
void cacheShownText()
Definition: eda_text.cpp:189
wxString m_text
Definition: eda_text.h:411
static bool Replace(const wxFindReplaceData &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition: eda_item.cpp:170

References cacheShownText(), m_text, and EDA_ITEM::Replace().

Referenced by SCH_SHEET_PIN::Replace(), SCH_FIELD::Replace(), and SCH_TEXT::Replace().

◆ SetBold()

◆ SetEffects()

void EDA_TEXT::SetEffects ( const EDA_TEXT aSrc)

Set the text effects from another instance.

TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual text string itself.

Definition at line 139 of file eda_text.cpp.

140 {
141  m_e = aSrc.m_e;
142 }
TEXT_EFFECTS m_e
Definition: eda_text.h:415

References m_e.

Referenced by LIB_TEXT::Clone(), LIB_FIELD::Copy(), SCH_FIELD::ImportValues(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), LIB_FIELD::operator=(), DIALOG_CHANGE_SYMBOLS::processSymbol(), CLIPBOARD_IO::SaveSelection(), and FP_TEXT::SetEffects().

◆ SetHorizJustify()

void EDA_TEXT::SetHorizJustify ( EDA_TEXT_HJUSTIFY_T  aType)
inline

Definition at line 222 of file eda_text.h.

222 { m_e.hjustify = aType; };
TEXT_EFFECTS m_e
Definition: eda_text.h:415
signed char hjustify
horizontal justification
Definition: eda_text.h:122

References TEXT_EFFECTS::hjustify, and m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_GLOBALLABEL::AutoplaceFields(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), eagleToKicadAlignment(), EDA_TEXT_DESC::EDA_TEXT_DESC(), ALTIUM_PCB::HelperParseDimensions6Radial(), AUTOPLACER::justifyField(), FP_TEXT::KeepUpright(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), ALTIUM_PCB::ParseTexts6Data(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), LIB_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_TEXT::SetLabelSpinStyle(), SCH_GLOBALLABEL::SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), PCAD2KICAD::SetTextJustify(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ SetItalic()

◆ SetMirrored()

◆ SetMultilineAllowed()

void EDA_TEXT::SetMultilineAllowed ( bool  aAllow)
inline
Parameters
aAllowtrue if ok to use multiline option, false if ok to use only single line text. (Single line is faster in calculations than multiline.)

Definition at line 216 of file eda_text.h.

216 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
void Bit(int aBit, bool aValue)
Definition: eda_text.h:129

References TEXT_EFFECTS::Bit(), m_e, and TE_MULTILINE.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_TEXT::PCB_TEXT(), SCH_HIERLABEL::SCH_HIERLABEL(), SCH_LABEL::SCH_LABEL(), and SCH_TEXT::SCH_TEXT().

◆ SetText()

void EDA_TEXT::SetText ( const wxString &  aText)
virtual

Definition at line 124 of file eda_text.cpp.

125 {
126  m_text = aText;
127  cacheShownText();
128 }
void cacheShownText()
Definition: eda_text.cpp:189
wxString m_text
Definition: eda_text.h:411

References cacheShownText(), and m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), LIB_TEXT::Clone(), createBoard(), PCB_BASE_FRAME::CreateNewFootprint(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), FOOTPRINT::DuplicateItem(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), SCH_SYMBOL::GetValue(), LIB_FIELD::HitTest(), SCH_TEXT::IncrementLabel(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), SCH_LEGACY_PLUGIN_CACHE::loadField(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FABMASTER::loadFootprints(), SCH_EAGLE_PLUGIN::loadFrame(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_LEGACY_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_LEGACY_PLUGIN::loadSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), LIB_FIELD::operator=(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseFileName(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseSheetEntry(), SCH_ALTIUM_PLUGIN::ParseSheetName(), ALTIUM_PCB::ParseTexts6Data(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), LIB_SYMBOL::PlotLibFields(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), CLIPBOARD_IO::SaveSelection(), SCH_SYMBOL::SCH_SYMBOL(), LIB_SYMBOL::SetName(), SCH_SYMBOL::SetRef(), FOOTPRINT::SetReference(), FOOTPRINT::SetValue(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), SCH_SYMBOL::UpdateFields(), SCH_SHEET_LIST::UpdateSymbolInstances(), PCB_DIMENSION_BASE::updateText(), and SIM_PLOT_FRAME::UpdateTunerValue().

◆ SetTextAngle()

virtual void EDA_TEXT::SetTextAngle ( double  aAngle)
inlinevirtual

◆ SetTextHeight()

void EDA_TEXT::SetTextHeight ( int  aHeight)
inline

◆ SetTextPos()

void EDA_TEXT::SetTextPos ( const wxPoint &  aPoint)
inline

Definition at line 267 of file eda_text.h.

267 { m_e.pos = aPoint; }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
wxPoint pos
Definition: eda_text.h:127

References m_e, and TEXT_EFFECTS::pos.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute(), SCH_GLOBALLABEL::AutoplaceFields(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_TEXT::CalcEdit(), LIB_FIELD::CalcEdit(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), FP_TEXT::FP_TEXT(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_LEGACY_PLUGIN::loadSymbol(), PCB_DIMENSION_BASE::Mirror(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MoveTo(), LIB_FIELD::MoveTo(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseSchText(), DRAWING_TOOL::PlaceText(), DIALOG_CHANGE_SYMBOLS::processSymbol(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), LIB_FIELD::Rotate(), SCH_SHEET_PIN::Rotate(), SCH_TEXT::Rotate(), PCB_DIMENSION_BASE::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_FIELD::SCH_FIELD(), SCH_SHEET_PIN::SCH_SHEET_PIN(), SCH_TEXT::SCH_TEXT(), FP_TEXT::SetDrawCoord(), PCB_TEXT::SetPosition(), FP_TEXT::SetPosition(), SCH_FIELD::SetPosition(), SCH_TEXT::SetPosition(), DS_DRAW_ITEM_TEXT::SetPosition(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), SCH_SYMBOL::UpdateFields(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_ORTHOGONAL::updateText().

◆ SetTextSize()

void EDA_TEXT::SetTextSize ( const wxSize &  aNewSize)
inline

Definition at line 258 of file eda_text.h.

258 { m_e.size = aNewSize; }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
wxSize size
Definition: eda_text.h:124

References m_e, and TEXT_EFFECTS::size.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), EDA_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), ALTIUM_PCB::HelperParseDimensions6Linear(), ALTIUM_PCB::HelperParseDimensions6Radial(), LIB_TEXT::LIB_TEXT(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), SCH_EAGLE_PLUGIN::loadFrame(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_LEGACY_PLUGIN::loadSheet(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseLabel(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BACK_ANNOTATE::processNetNameChange(), PCB_DIMENSION_BASE::SetTextSize(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), SCH_GLOBALLABEL::UpdateIntersheetRefProps(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetTextThickness()

void EDA_TEXT::SetTextThickness ( int  aWidth)
inline

The TextThickness is that set by the user.

The EffectiveTextPenWidth also factors in bold text and thickness clamping.

Definition at line 180 of file eda_text.h.

180 { m_e.penwidth = aWidth; };
TEXT_EFFECTS m_e
Definition: eda_text.h:415
int penwidth
Definition: eda_text.h:125

References m_e, and TEXT_EFFECTS::penwidth.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), EDA_TEXT_DESC::EDA_TEXT_DESC(), FP_TEXT::FP_TEXT(), ALTIUM_PCB::HelperParseDimensions6Linear(), ALTIUM_PCB::HelperParseDimensions6Radial(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), and SCH_GLOBALLABEL::UpdateIntersheetRefProps().

◆ SetTextWidth()

void EDA_TEXT::SetTextWidth ( int  aWidth)
inline

◆ SetTextX()

◆ SetTextY()

◆ SetVertJustify()

◆ SetVisible()

virtual void EDA_TEXT::SetVisible ( bool  aVisible)
inlinevirtual

Reimplemented in PCB_TEXT.

Definition at line 206 of file eda_text.h.

206 { m_e.Bit( TE_VISIBLE, aVisible ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:415
void Bit(int aBit, bool aValue)
Definition: eda_text.h:129

References TEXT_EFFECTS::Bit(), m_e, and TE_VISIBLE.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), SCH_EDITOR_CONTROL::AssignFootprints(), PCB_BASE_FRAME::CreateNewFootprint(), EDA_TEXT_DESC::EDA_TEXT_DESC(), LIB_FIELD::Init(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_LEGACY_PLUGIN::loadSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), ALTIUM_PCB::ParseComponents6Data(), SCH_ALTIUM_PLUGIN::ParseDesignator(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseFileName(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseSheetName(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), SCH_FIELD::SCH_FIELD(), SCH_EDIT_FRAME::ShowAllIntersheetRefs(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ ShortenedShownText()

wxString EDA_TEXT::ShortenedShownText ( ) const

Returns a shortened version (max 15 characters) of the shown text.

Definition at line 218 of file eda_text.cpp.

219 {
220  wxString tmp = GetShownText();
221 
222  tmp.Replace( wxT( "\n" ), wxT( " " ) );
223  tmp.Replace( wxT( "\r" ), wxT( " " ) );
224  tmp.Replace( wxT( "\t" ), wxT( " " ) );
225 
226  if( tmp.Length() > 36 )
227  tmp = tmp.Left( 34 ) + wxT( "..." );
228 
229  return tmp;
230 }
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162

References GetShownText().

Referenced by LIB_TEXT::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), LIB_FIELD::GetSelectMenuText(), SCH_SHEET_PIN::GetSelectMenuText(), SCH_FIELD::GetSelectMenuText(), FP_TEXT::GetSelectMenuText(), SCH_TEXT::GetSelectMenuText(), SCH_LABEL::GetSelectMenuText(), SCH_GLOBALLABEL::GetSelectMenuText(), and SCH_HIERLABEL::GetSelectMenuText().

◆ SwapEffects()

void EDA_TEXT::SwapEffects ( EDA_TEXT aTradingPartner)

Swap the text effects of the two involved instances.

TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual text string itself.

Definition at line 153 of file eda_text.cpp.

154 {
155  std::swap( m_e, aTradingPartner.m_e );
156 }
TEXT_EFFECTS m_e
Definition: eda_text.h:415

References m_e.

Referenced by SCH_FIELD::SwapData(), SCH_TEXT::SwapData(), and FP_TEXT::SwapEffects().

◆ SwapText()

void EDA_TEXT::SwapText ( EDA_TEXT aTradingPartner)

Definition at line 145 of file eda_text.cpp.

146 {
147  std::swap( m_text, aTradingPartner.m_text );
148  std::swap( m_shown_text, aTradingPartner.m_shown_text );
150 }
wxString m_shown_text
Definition: eda_text.h:412
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:413
wxString m_text
Definition: eda_text.h:411

References m_shown_text, m_shown_text_has_text_var_refs, and m_text.

Referenced by SCH_FIELD::SwapData(), and SCH_TEXT::SwapData().

◆ TextHitTest() [1/2]

bool EDA_TEXT::TextHitTest ( const wxPoint &  aPoint,
int  aAccuracy = 0 
) const
virtual

Test if aPoint is within the bounds of this object.

Parameters
aPointA wxPoint to test.
aAccuracyAmount to inflate the bounding box.
Returns
true if a hit, else false.

Reimplemented in FP_TEXT, and PCB_TEXT.

Definition at line 395 of file eda_text.cpp.

396 {
397  EDA_RECT rect = GetTextBox();
398  wxPoint location = aPoint;
399 
400  rect.Inflate( aAccuracy );
401  RotatePoint( &location, GetTextPos(), -GetTextAngle() );
402 
403  return rect.Contains( location );
404 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:239
double GetTextAngle() const
Definition: eda_text.h:195
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), GetTextAngle(), GetTextBox(), GetTextPos(), EDA_RECT::Inflate(), and RotatePoint().

Referenced by LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), DS_DRAW_ITEM_TEXT::HitTest(), and PCB_TEXT::TextHitTest().

◆ TextHitTest() [2/2]

bool EDA_TEXT::TextHitTest ( const EDA_RECT aRect,
bool  aContains,
int  aAccuracy = 0 
) const
virtual

Test if object bounding box is contained within or intersects aRect.

Parameters
aRectRect to test against.
aContainsTest for containment instead of intersection if true.
aAccuracyAmount to inflate the bounding box.
Returns
true if a hit, else false.

Reimplemented in FP_TEXT, and PCB_TEXT.

Definition at line 407 of file eda_text.cpp.

408 {
409  EDA_RECT rect = aRect;
410 
411  rect.Inflate( aAccuracy );
412 
413  if( aContains )
414  return rect.Contains( GetTextBox() );
415 
416  return rect.Intersects( GetTextBox(), GetTextAngle() );
417 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:239
double GetTextAngle() const
Definition: eda_text.h:195
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), GetTextAngle(), GetTextBox(), EDA_RECT::Inflate(), and EDA_RECT::Intersects().

◆ TransformBoundingBoxWithClearanceToPolygon()

void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
int  aClearanceValue 
) const

Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical.

Used in filling zones calculations Circles and arcs are approximated by segments

Parameters
aCornerBuffera buffer to store the polygon.
aClearanceValuethe clearance around the text bounding box to the real clearance value (usually near from 1.0).

Definition at line 681 of file eda_text.cpp.

683 {
684  if( GetText().Length() == 0 )
685  return;
686 
687  wxPoint corners[4]; // Buffer of polygon corners
688 
689  EDA_RECT rect = GetTextBox();
690 
691  rect.Inflate( aClearanceValue );
692 
693  corners[0].x = rect.GetOrigin().x;
694  corners[0].y = rect.GetOrigin().y;
695  corners[1].y = corners[0].y;
696  corners[1].x = rect.GetRight();
697  corners[2].x = corners[1].x;
698  corners[2].y = rect.GetBottom();
699  corners[3].y = corners[2].y;
700  corners[3].x = corners[0].x;
701 
702  aCornerBuffer->NewOutline();
703 
704  for( wxPoint& corner : corners )
705  {
706  // Rotate polygon
707  RotatePoint( &corner.x, &corner.y, GetTextPos().x, GetTextPos().y, GetTextAngle() );
708  aCornerBuffer->Append( corner.x, corner.y );
709  }
710 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:239
double GetTextAngle() const
Definition: eda_text.h:195
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
int GetBottom() const
Definition: eda_rect.h:123
const wxPoint GetOrigin() const
Definition: eda_rect.h:110
int GetRight() const
Definition: eda_rect.h:120
int NewOutline()
Creates a new hole in a given outline.
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), EDA_RECT::GetBottom(), EDA_RECT::GetOrigin(), EDA_RECT::GetRight(), GetText(), GetTextAngle(), GetTextBox(), GetTextPos(), EDA_RECT::Inflate(), SHAPE_POLY_SET::NewOutline(), and RotatePoint().

Referenced by PCB_TEXT::TransformShapeWithClearanceToPolygon().

◆ TransformToSegmentList()

std::vector< wxPoint > EDA_TEXT::TransformToSegmentList ( ) const

Convert the text shape to a list of segment.

Each segment is stored as 2 wxPoints: the starting point and the ending point there are therefore 2*n points.

Definition at line 606 of file eda_text.cpp.

607 {
608  std::vector<wxPoint> cornerBuffer;
609  wxSize size = GetTextSize();
610 
611  if( IsMirrored() )
612  size.x = -size.x;
613 
614  bool forceBold = true;
615  int penWidth = 0; // use max-width for bold text
616 
617  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
618 
619  if( IsMultilineAllowed() )
620  {
621  wxArrayString strings_list;
622  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
623  std::vector<wxPoint> positions;
624  positions.reserve( strings_list.Count() );
625  GetLinePositions( positions, strings_list.Count() );
626 
627  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
628  {
629  wxString txt = strings_list.Item( ii );
630  GRText( nullptr, positions[ii], color, txt, GetDrawRotation(), size,
631  GetDrawHorizJustify(), GetDrawVertJustify(), penWidth, IsItalic(), forceBold,
632  addTextSegmToBuffer, &cornerBuffer );
633  }
634  }
635  else
636  {
637  GRText( nullptr, GetDrawPos(), color, GetShownText(), GetDrawRotation(), size,
638  GetDrawHorizJustify(), GetDrawVertJustify(), penWidth, IsItalic(), forceBold,
639  addTextSegmToBuffer, &cornerBuffer );
640  }
641 
642  return cornerBuffer;
643 }
bool IsMirrored() const
Definition: eda_text.h:210
virtual double GetDrawRotation() const
Definition: eda_text.h:388
int color
Definition: DXF_plotter.cpp:57
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf, void *aData)
Definition: eda_text.cpp:598
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), void *aCallbackData, PLOTTER *aPlotter)
Draw a graphic text (like footprint texts).
Definition: gr_text.cpp:129
Definition: color4d.h:44
bool IsItalic() const
Definition: eda_text.h:201
const wxSize & GetTextSize() const
Definition: eda_text.h:259
virtual EDA_TEXT_VJUSTIFY_T GetDrawVertJustify() const
Definition: eda_text.h:391
bool IsMultilineAllowed() const
Definition: eda_text.h:217
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:443
virtual EDA_TEXT_HJUSTIFY_T GetDrawHorizJustify() const
Definition: eda_text.h:390
virtual wxPoint GetDrawPos() const
Definition: eda_text.h:389
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References addTextSegmToBuffer(), BLACK, color, GetDrawHorizJustify(), GetDrawPos(), GetDrawRotation(), GetDrawVertJustify(), GetLinePositions(), GetShownText(), GetTextSize(), GRText(), IsItalic(), IsMirrored(), IsMultilineAllowed(), and wxStringSplit().

Referenced by GetEffectiveTextShape(), and PNS_KICAD_IFACE_BASE::syncTextItem().

Member Data Documentation

◆ m_e

◆ m_shown_text

wxString EDA_TEXT::m_shown_text
private

Definition at line 412 of file eda_text.h.

Referenced by cacheShownText(), CopyText(), GetShownText(), and SwapText().

◆ m_shown_text_has_text_var_refs

bool EDA_TEXT::m_shown_text_has_text_var_refs
private

Definition at line 413 of file eda_text.h.

Referenced by cacheShownText(), CopyText(), HasTextVars(), and SwapText().

◆ m_text

wxString EDA_TEXT::m_text
private

Definition at line 411 of file eda_text.h.

Referenced by cacheShownText(), Compare(), CopyText(), Empty(), GetText(), Replace(), SetText(), and SwapText().


The documentation for this class was generated from the following files: