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:
FP_TEXT LIB_FIELD LIB_TEXT PCB_TEXT SCH_FIELD SCH_TEXT WS_DRAW_ITEM_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 GetShownText (bool *processTextVars) const
 A version of GetShownText() which also indicates whether or not the text needs to be processed for text variables. More...
 
wxString ShortenedShownText () const
 Returns a shortened version (max 15 characters) of the shown text. 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
 
void SetVisible (bool aVisible)
 
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 (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 (RENDER_SETTINGS *aSettings, const wxPoint &aOffset, 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
 

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 printOneLineOfText (RENDER_SETTINGS *aSettings, const wxPoint &aOffset, 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 119 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 383 of file eda_text.h.

Constructor & Destructor Documentation

◆ EDA_TEXT() [1/2]

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

Definition at line 91 of file eda_text.cpp.

91  :
92  m_text( text ),
93  m_e( 1<<TE_VISIBLE )
94 {
95  int sz = Mils2iu( DEFAULT_SIZE_TEXT );
96  SetTextSize( wxSize( sz, sz ) );
98 
99  if( !text.IsEmpty() )
100  {
101  m_shown_text = UnescapeString( text );
102  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
103  }
104 }
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:80
wxString m_shown_text
Definition: eda_text.h:378
TEXT_EFFECTS m_e
Definition: eda_text.h:381
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
wxString m_text
Definition: eda_text.h:377
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

References DEFAULT_SIZE_TEXT, m_shown_text, m_shown_text_has_text_var_refs, SetTextSize(), and UnescapeString().

◆ EDA_TEXT() [2/2]

EDA_TEXT::EDA_TEXT ( const EDA_TEXT aText)

Definition at line 107 of file eda_text.cpp.

107  :
108  m_text( aText.m_text ),
109  m_e( aText.m_e )
110 {
112  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
113 }
wxString m_shown_text
Definition: eda_text.h:378
TEXT_EFFECTS m_e
Definition: eda_text.h:381
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379
wxString m_text
Definition: eda_text.h:377
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

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

◆ ~EDA_TEXT()

EDA_TEXT::~EDA_TEXT ( )
virtual

Definition at line 116 of file eda_text.cpp.

117 {
118 }

Member Function Documentation

◆ CopyText()

void EDA_TEXT::CopyText ( const EDA_TEXT aSrc)

Definition at line 129 of file eda_text.cpp.

130 {
131  m_text = aSrc.m_text;
132  m_shown_text = aSrc.m_shown_text;
134 }
wxString m_shown_text
Definition: eda_text.h:378
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379
wxString m_text
Definition: eda_text.h:377

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 261 of file eda_text.h.

261 { m_text.Empty(); }
wxString m_text
Definition: eda_text.h:377

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 520 of file eda_text.cpp.

521 {
522 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
523  // and does not define FormatInternalUnits, used here
524  // however this function should exist
525 
526  aFormatter->Print( aNestLevel + 1, "(effects" );
527 
528  // Text size
529  aFormatter->Print( 0, " (font" );
530 
531  aFormatter->Print( 0, " (size %s %s)",
532  FormatInternalUnits( GetTextHeight() ).c_str(),
533  FormatInternalUnits( GetTextWidth() ).c_str() );
534 
535  if( GetTextThickness() )
536  aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() );
537 
538  if( IsBold() )
539  aFormatter->Print( 0, " bold" );
540 
541  if( IsItalic() )
542  aFormatter->Print( 0, " italic" );
543 
544  aFormatter->Print( 0, ")"); // (font
545 
546  if( IsMirrored() ||
549  {
550  aFormatter->Print( 0, " (justify");
551 
553  aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
554 
556  aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
557 
558  if( IsMirrored() )
559  aFormatter->Print( 0, " mirror" );
560  aFormatter->Print( 0, ")" ); // (justify
561  }
562 
563  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
564  aFormatter->Print( 0, " hide" );
565 
566  aFormatter->Print( 0, ")\n" ); // (justify
567 
568 #endif
569 }
bool IsBold() const
Definition: eda_text.h:189
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:195
bool IsVisible() const
Definition: eda_text.h:192
int GetTextThickness() const
Definition: eda_text.h:165
int GetTextHeight() const
Definition: eda_text.h:251
bool IsItalic() const
Definition: eda_text.h:186
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
int GetTextWidth() const
Definition: eda_text.h:248
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
#define CTL_OMIT_HIDE
Definition: eda_text.h:56
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:528

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().

◆ GetDrawRotation()

double EDA_TEXT::GetDrawRotation ( ) const
virtual

Reimplemented in FP_TEXT.

Definition at line 637 of file eda_text.cpp.

638 {
639  return GetTextAngle();
640 }
double GetTextAngle() const
Definition: eda_text.h:180

References GetTextAngle().

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 157 of file eda_text.cpp.

158 {
159  int width = GetTextThickness();
160 
161  if( width <= 1 )
162  {
163  width = aDefaultWidth;
164 
165  if( IsBold() )
166  width = GetPenSizeForBold( GetTextWidth() );
167  else if( width <= 1 )
168  width = GetPenSizeForNormal( GetTextWidth() );
169  }
170 
171  // Clip pen size for small texts:
173 
174  return width;
175 }
bool IsBold() const
Definition: eda_text.h:189
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:48
int GetTextThickness() const
Definition: eda_text.h:165
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:69
const wxSize & GetTextSize() const
Definition: eda_text.h:245
int GetPenSizeForNormal(int aTextSize)
Function GetPensizeForNormal.
Definition: gr_text.cpp:54
#define ALLOW_BOLD_THICKNESS
Definition: base_units.h:57
int GetTextWidth() const
Definition: eda_text.h:248

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

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), KIGFX::WS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), export_vrml_fp_text(), export_vrml_pcbtext(), SCH_GLOBALLABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), 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(), PlotWorkSheet(), LIB_TEXT::print(), SCH_FIELD::Print(), printOneLineOfText(), PNS_KICAD_IFACE_BASE::syncTextItem(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), ALIGNED_DIMENSION::updateGeometry(), ORTHOGONAL_DIMENSION::updateGeometry(), LEADER::updateGeometry(), ALIGNED_DIMENSION::updateText(), and ORTHOGONAL_DIMENSION::updateText().

◆ GetEffectiveTextShape()

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

Definition at line 624 of file eda_text.cpp.

625 {
626  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
627  int penWidth = GetEffectiveTextPenWidth();
628  std::vector<wxPoint> pts = TransformToSegmentList();
629 
630  for( unsigned jj = 0; jj < pts.size(); jj += 2 )
631  shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
632 
633  return shape;
634 }
std::vector< wxPoint > TransformToSegmentList() const
Convert the text shape to a list of segment.
Definition: eda_text.cpp:584
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157

References GetEffectiveTextPenWidth(), and TransformToSegmentList().

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

◆ GetHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetHorizJustify ( ) const
inline

Definition at line 205 of file eda_text.h.

205 { return EDA_TEXT_HJUSTIFY_T( m_e.hjustify ); };
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:61
TEXT_EFFECTS m_e
Definition: eda_text.h:381
signed char hjustify
horizontal justification
Definition: eda_text.h:101

References TEXT_EFFECTS::hjustify, and m_e.

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT_DESC::EDA_TEXT_DESC(), export_vrml_fp_text(), export_vrml_pcbtext(), AUTOPLACER::field_horiz_placement(), PCB_TEXT::Flip(), FP_TEXT::Flip(), Format(), GetTextBox(), hash_fp_item(), IsDefaultFormatting(), SCH_FIELD::IsHorizJustifyFlipped(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), PlotWorkSheet(), 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_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), TransformToSegmentList(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().

◆ 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 217 of file eda_text.cpp.

218 {
220 }
static double GetInterline(double aGlyphHeight)
Compute the distance (interline) between 2 lines of text (for multiline texts).
int GetTextHeight() const
Definition: eda_text.h:251
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:68

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

Referenced by GetLinePositions(), and GetTextBox().

◆ 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 424 of file eda_text.cpp.

425 {
426  wxPoint pos = GetTextPos(); // Position of first line of the
427  // multiline text according to
428  // the center of the multiline text block
429 
430  wxPoint offset; // Offset to next line.
431 
432  offset.y = GetInterline();
433 
434  if( aLineCount > 1 )
435  {
436  switch( GetVertJustify() )
437  {
439  break;
440 
442  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
443  break;
444 
446  pos.y -= ( aLineCount - 1 ) * offset.y;
447  break;
448  }
449  }
450 
451  // Rotate the position of the first line
452  // around the center of the multiline text block
453  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
454 
455  // Rotate the offset lines to increase happened in the right direction
456  RotatePoint( &offset, GetTextAngle() );
457 
458  for( int ii = 0; ii < aLineCount; ii++ )
459  {
460  aPositions.push_back( pos );
461  pos += offset;
462  }
463 }
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:217
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
double GetTextAngle() const
Definition: eda_text.h:180
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
const wxPoint & GetTextPos() const
Definition: eda_text.h:254

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

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), export_vrml_pcbtext(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), Print(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and TransformToSegmentList().

◆ GetShownText() [1/2]

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

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

@aParam aDepth is used to prevent infinite recusions and loops when expanding text variables.

Reimplemented in FP_TEXT, SCH_TEXT, SCH_FIELD, and PCB_TEXT.

Definition at line 140 of file eda_text.h.

140 { return m_shown_text; }
wxString m_shown_text
Definition: eda_text.h:378

References m_shown_text.

Referenced by KIGFX::WS_PAINTER::draw(), LIB_FIELD::GetMsgPanelInfo(), WS_DRAW_ITEM_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), FP_TEXT::GetShownText(), GetTextBox(), LIB_FIELD::Plot(), LIB_PART::PlotLibFields(), PlotWorkSheet(), LIB_TEXT::print(), Print(), ShortenedShownText(), DRC_TEST_PROVIDER_MISC::testTextVars(), and TransformToSegmentList().

◆ GetShownText() [2/2]

wxString EDA_TEXT::GetShownText ( bool *  processTextVars) const
inline

A version of GetShownText() which also indicates whether or not the text needs to be processed for text variables.

Parameters
processTextVars[out]

Definition at line 147 of file eda_text.h.

148  {
149  *processTextVars = m_shown_text_has_text_var_refs;
150  return m_shown_text;
151  }
wxString m_shown_text
Definition: eda_text.h:378
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379

References m_shown_text, and m_shown_text_has_text_var_refs.

◆ 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 133 of file eda_text.h.

133 { return m_text; }
wxString m_text
Definition: eda_text.h:377

References m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), NETLIST_EXPORTER_XML::addSymbolFields(), SIM_PLOT_FRAME::AddTuner(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_EDIT_TOOL::ChangeTextType(), LIB_TEXT::Clone(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), KIGFX::SCH_VIEW::DisplayComponent(), SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet(), SCH_FIELD::DoHypertextMenu(), KIGFX::SCH_PAINTER::draw(), SCH_EDIT_TOOL::Duplicate(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CONNECTION_GRAPH::ercCheckHierSheets(), LIB_PART::Flatten(), PCB_IO::format(), FormatProbeItem(), SCH_COMPONENT::GetFootprint(), LIB_FIELD::GetFullText(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), FP_TEXT::GetLength(), getMatchingTextItem(), SCH_COMPONENT::GetRef(), LIB_PART::GetSearchText(), DIMENSION_BASE::GetText(), TEXT_MOD_GRID_TABLE::GetValue(), SCH_COMPONENT::GetValue(), hash_fp_item(), LIB_FIELD::HitTest(), SCH_EDIT_FRAME::importFile(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_TEXT::IncrementLabel(), GENERAL_COLLECTOR::Inspect(), SCH_SCREEN::IsTerminalPoint(), SCH_FIELD::IsVoid(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_EAGLE_PLUGIN::loadSegments(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::operator<(), SCH_TEXT::operator<(), LIB_FIELD::operator=(), SCH_COMPONENT::operator==(), PCB_PARSER::parseDIMENSION(), 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_LEGACY_PLUGIN::saveComponent(), 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_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_COMPONENT::SetRef(), LIB_VIEW_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_SHEET::SymbolCount(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TransformBoundingBoxWithClearanceToPolygon(), TUNER_SLIDER::TUNER_SLIDER(), LIB_DRAWING_TOOLS::TwoClickPlace(), DIALOG_FOOTPRINT_FP_EDITOR::Validate(), DIALOG_FOOTPRINT_PROPERTIES::Validate(), and FP_TEXT::ViewGetLOD().

◆ GetTextAngle()

double EDA_TEXT::GetTextAngle ( ) const
inline

Definition at line 180 of file eda_text.h.

180 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:105

References TEXT_EFFECTS::angle, and m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOARD_ADAPTER::AddShapeWithClearanceToContainer(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), KIGFX::WS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), export_vrml_pcbtext(), PCB_TEXT::Flip(), FP_TEXT::Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), FP_TEXT::GetDrawRotation(), GetDrawRotation(), GetLinePositions(), PCB_TEXT::GetMsgPanelInfo(), GetTextAngleDegrees(), GetTextAngleRadians(), TEXT_MOD_GRID_TABLE::GetValue(), hash_fp_item(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), FP_TEXT::KeepUpright(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), PCB_PARSER::parseFOOTPRINT_unchecked(), ALTIUM_PCB::ParseTexts6Data(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), PlotWorkSheet(), positioningChanged(), LIB_TEXT::print(), LIB_FIELD::print(), SCH_FIELD::Print(), printOneLineOfText(), SCH_EDIT_TOOL::Rotate(), LIB_TEXT::Rotate(), PCB_TEXT::Rotate(), FP_TEXT::Rotate(), LIB_FIELD::Rotate(), 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_EDIT_TEXT::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), TransformBoundingBoxWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and DIALOG_SCH_EDIT_ONE_FIELD::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 223 of file eda_text.cpp.

224 {
225  EDA_RECT rect;
226  wxArrayString strings;
227  wxString text = GetShownText();
228  int thickness = GetEffectiveTextPenWidth();
229  int linecount = 1;
230  bool hasOverBar = false; // true if the first line of text as an overbar
231 
232  if( IsMultilineAllowed() )
233  {
234  wxStringSplit( text, strings, '\n' );
235 
236  if( strings.GetCount() ) // GetCount() == 0 for void strings
237  {
238  if( aLine >= 0 && ( aLine < (int)strings.GetCount() ) )
239  text = strings.Item( aLine );
240  else
241  text = strings.Item( 0 );
242 
243  linecount = strings.GetCount();
244  }
245  }
246 
247  // Search for overbar symbol. Only text is scanned,
248  // because only this line can change the bounding box
249  for( unsigned ii = 1; ii < text.size(); ii++ )
250  {
251  if( text[ii-1] == '~' && text[ii] != '~' )
252  {
253  hasOverBar = true;
254  break;
255  }
256  }
257 
258  // calculate the H and V size
259  const auto& font = basic_gal.GetStrokeFont();
260  VECTOR2D fontSize( GetTextSize() );
261  double penWidth( thickness );
262  int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
263  int dy = GetInterline();
264 
265  // Creates bounding box (rectangle) for horizontal, left and top justified text. The
266  // bounding box will be moved later according to the actual text options
267  wxSize textsize = wxSize( dx, dy );
268  wxPoint pos = GetTextPos();
269 
270  if( aInvertY )
271  pos.y = -pos.y;
272 
273  rect.SetOrigin( pos );
274 
275  // The bbox vertical size returned by GetInterline( aThickness )
276  // includes letters like j and y and ] + interval between lines.
277  // The interval below the last line is not usefull, and we can use its half value
278  // as vertical margin above the text
279  // the full interval is roughly GetTextHeight() * 0.4 - aThickness/2
280  rect.Move( wxPoint( 0, thickness/4 - KiROUND( GetTextHeight() * 0.22 ) ) );
281 
282  if( hasOverBar )
283  { // A overbar adds an extra size to the text
284  // Height from the base line text of chars like [ or {
285  double curr_height = GetTextHeight() * 1.15;
286  double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
287  int extra_height = KiROUND( overbarPosition - curr_height );
288 
289  extra_height += thickness / 2;
290  textsize.y += extra_height;
291  rect.Move( wxPoint( 0, -extra_height ) );
292  }
293 
294  // for multiline texts and aLine < 0, merge all rectangles
295  // ( if aLine < 0, we want the full text bounding box )
296  if( IsMultilineAllowed() && aLine < 0 )
297  {
298  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
299  {
300  text = strings.Item( ii );
301  dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
302  textsize.x = std::max( textsize.x, dx );
303  textsize.y += dy;
304  }
305  }
306 
307  rect.SetSize( textsize );
308 
309  /* Now, calculate the rect origin, according to text justification
310  * At this point the rectangle origin is the text origin (m_Pos).
311  * This is true only for left and top text justified texts (using top to bottom Y axis
312  * orientation). and must be recalculated for others justifications
313  * also, note the V justification is relative to the first line
314  */
315  switch( GetHorizJustify() )
316  {
318  if( IsMirrored() )
319  rect.SetX( rect.GetX() - rect.GetWidth() );
320  break;
321 
323  rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
324  break;
325 
327  if( !IsMirrored() )
328  rect.SetX( rect.GetX() - rect.GetWidth() );
329  break;
330  }
331 
332  dy = GetTextHeight() + thickness;
333 
334  switch( GetVertJustify() )
335  {
337  break;
338 
340  rect.SetY( rect.GetY() - ( dy / 2) );
341  break;
342 
344  rect.SetY( rect.GetY() - dy );
345  break;
346  }
347 
348  if( linecount > 1 )
349  {
350  int yoffset;
351  linecount -= 1;
352 
353  switch( GetVertJustify() )
354  {
356  break;
357 
359  yoffset = linecount * GetInterline() / 2;
360  rect.SetY( rect.GetY() - yoffset );
361  break;
362 
364  yoffset = linecount * GetInterline();
365  rect.SetY( rect.GetY() - yoffset );
366  break;
367  }
368  }
369 
370  rect.Normalize(); // Make h and v sizes always >= 0
371 
372  return rect;
373 }
const STROKE_FONT & GetStrokeFont() const
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:217
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
Definition: eda_rect.cpp:51
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:195
int GetX() const
Definition: eda_rect.h:111
int GetWidth() const
Definition: eda_rect.h:119
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
int GetTextHeight() const
Definition: eda_text.h:251
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
const wxSize & GetTextSize() const
Definition: eda_text.h:245
void SetX(int val)
Definition: eda_rect.h:168
bool IsMultilineAllowed() const
Definition: eda_text.h:203
void SetY(int val)
Definition: eda_rect.h:174
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:802
void Normalize()
Function Normalize ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetY() const
Definition: eda_rect.h:112
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:68
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
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:140

References basic_gal, GetEffectiveTextPenWidth(), GetHorizJustify(), 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, IsMirrored(), IsMultilineAllowed(), KiROUND(), EDA_RECT::Move(), EDA_RECT::Normalize(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), EDA_RECT::SetX(), EDA_RECT::SetY(), wxStringSplit(), and VECTOR2< T >::y.

Referenced by PCB_TEXT::Flip(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), FP_TEXT::GetBoundingBox(), DIMENSION_BASE::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), WS_DRAW_ITEM_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), LIB_TEXT::NormalizeJustification(), FP_TEXT::TextHitTest(), TextHitTest(), TransformBoundingBoxWithClearanceToPolygon(), ALIGNED_DIMENSION::updateGeometry(), ORTHOGONAL_DIMENSION::updateGeometry(), LEADER::updateGeometry(), and FP_TEXT::ViewBBox().

◆ GetTextHeight()

◆ GetTextPos()

const wxPoint& EDA_TEXT::GetTextPos ( ) const
inline

Definition at line 254 of file eda_text.h.

254 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
wxPoint pos
Definition: eda_text.h:106

References m_e, and TEXT_EFFECTS::pos.

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), SCH_LABEL::doIsConnected(), SCH_GLOBALLABEL::doIsConnected(), SCH_HIERLABEL::doIsConnected(), KIGFX::WS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), export_vrml_fp_text(), export_vrml_pcbtext(), FP_TEXT::Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), FP_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), SCH_TEXT::GetConnectionPoints(), SCH_SHEET_PIN::GetEndPoints(), SCH_TEXT::GetEndPoints(), SCH_FIELD::GetLibPosition(), GetLinePositions(), PCB_TEXT::GetPosition(), LIB_TEXT::GetPosition(), FP_TEXT::GetPosition(), LIB_FIELD::GetPosition(), SCH_FIELD::GetPosition(), WS_DRAW_ITEM_TEXT::GetPosition(), SCH_TEXT::GetPosition(), GetTextBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), FP_TEXT::Mirror(), DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_FIELD::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_FIELD::MirrorVertical(), SCH_SHEET_PIN::MirrorX(), SCH_TEXT::MirrorX(), SCH_SHEET_PIN::MirrorY(), SCH_TEXT::MirrorY(), LIB_TEXT::NormalizeJustification(), PCB_PARSER::parseDIMENSION(), DRAWING_TOOL::PlaceText(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), PlotWorkSheet(), LIB_FIELD::print(), Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), LIB_TEXT::Rotate(), PCB_TEXT::Rotate(), FP_TEXT::Rotate(), SCH_FIELD::Rotate(), SCH_SHEET_PIN::Rotate(), LIB_FIELD::Rotate(), DIMENSION_BASE::Rotate(), SCH_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), FP_TEXT::SetDrawCoord(), FP_TEXT::SetLocalCoord(), SCH_COMPONENT::SetRef(), FP_TEXT::TextHitTest(), TextHitTest(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), TransformBoundingBoxWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), TransformToSegmentList(), SCH_TEXT::UpdateDanglingState(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), 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 485 of file eda_text.cpp.

486 {
487  int style = 0;
488 
489  if( IsItalic() )
490  style = 1;
491 
492  if( IsBold() )
493  style += 2;
494 
495  wxString stylemsg[4] = {
496  _("Normal"),
497  _("Italic"),
498  _("Bold"),
499  _("Bold+Italic")
500  };
501 
502  return stylemsg[style];
503 }
bool IsBold() const
Definition: eda_text.h:189
bool IsItalic() const
Definition: eda_text.h:186
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by LIB_FIELD::GetMsgPanelInfo().

◆ GetTextThickness()

◆ GetTextWidth()

◆ GetVertJustify()

◆ IsBold()

◆ IsDefaultFormatting()

bool EDA_TEXT::IsDefaultFormatting ( ) const

Definition at line 506 of file eda_text.cpp.

507 {
508  return ( IsVisible()
509  && !IsMirrored()
512  && GetTextThickness() == 0
513  && !IsItalic()
514  && !IsBold()
515  && !IsMultilineAllowed()
516  );
517 }
bool IsBold() const
Definition: eda_text.h:189
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:195
bool IsVisible() const
Definition: eda_text.h:192
int GetTextThickness() const
Definition: eda_text.h:165
bool IsItalic() const
Definition: eda_text.h:186
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
bool IsMultilineAllowed() const
Definition: eda_text.h:203

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()

bool EDA_TEXT::IsItalic ( ) const
inline

Definition at line 186 of file eda_text.h.

186 { return m_e.Bit( TE_ITALIC ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

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

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), SCH_EDIT_TOOL::ChangeTextType(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT_DESC::EDA_TEXT_DESC(), export_vrml_fp_text(), export_vrml_pcbtext(), Format(), SCH_TEXT::GetMsgPanelInfo(), GetTextStyleName(), TEXT_MOD_GRID_TABLE::GetValueAsBool(), hash_fp_item(), IsDefaultFormatting(), LenSize(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), PlotWorkSheet(), LIB_TEXT::print(), LIB_FIELD::print(), SCH_FIELD::Print(), printOneLineOfText(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), KIGFX::GAL::SetTextAttributes(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), TransformToSegmentList(), and SCH_GLOBALLABEL::UpdateIntersheetRefProps().

◆ IsMirrored()

◆ IsMultilineAllowed()

◆ IsVisible()

◆ LenSize()

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

Definition at line 188 of file eda_text.cpp.

189 {
192  basic_gal.SetFontUnderlined( false );
193  basic_gal.SetLineWidth( (float) aThickness );
195 
196  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
197 
198  return KiROUND( tsize.x );
199 }
bool IsBold() const
Definition: eda_text.h:189
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:186
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
const wxSize & GetTextSize() const
Definition: eda_text.h:245
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:68
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_GLOBALLABEL::GetBoundingBox(), and SCH_HIERLABEL::GetBoundingBox().

◆ MapHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
static

Definition at line 63 of file eda_text.cpp.

64 {
65  wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
66 
67  if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
69 
70  if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
71  return GR_TEXT_HJUSTIFY_LEFT;
72 
73  return (EDA_TEXT_HJUSTIFY_T) aHorizJustify;
74 }
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:61

References GR_TEXT_HJUSTIFY_LEFT, and GR_TEXT_HJUSTIFY_RIGHT.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ MapVertJustify()

EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
static

Definition at line 77 of file eda_text.cpp.

78 {
79  wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
80 
81  if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
83 
84  if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
85  return GR_TEXT_VJUSTIFY_TOP;
86 
87  return (EDA_TEXT_VJUSTIFY_T) aVertJustify;
88 }
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:68

References GR_TEXT_VJUSTIFY_BOTTOM, and GR_TEXT_VJUSTIFY_TOP.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ Offset()

◆ Print()

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

Print this text object to the device context aDC.

Parameters
aDC= the current Device Context
aOffset= draw offset (usually (0,0))
aColor= text color
aDisplay_mode= FILLED or SKETCH

Definition at line 401 of file eda_text.cpp.

403 {
404  if( IsMultilineAllowed() )
405  {
406  std::vector<wxPoint> positions;
407  wxArrayString strings;
408  wxStringSplit( GetShownText(), strings, '\n' );
409 
410  positions.reserve( strings.Count() );
411 
412  GetLinePositions( positions, strings.Count() );
413 
414  for( unsigned ii = 0; ii < strings.Count(); ii++ )
415  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
416  }
417  else
418  {
419  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
420  }
421 }
void printOneLineOfText(RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, OUTLINE_MODE aFillMode, const wxString &aText, const wxPoint &aPos)
Print each line of this EDA_TEXT.
Definition: eda_text.cpp:465
bool IsMultilineAllowed() const
Definition: eda_text.h:203
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:802
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:424
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:140

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

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

◆ printOneLineOfText()

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

Print each line of this EDA_TEXT.

Parameters
aOffset= draw offset (usually (0,0))
aColor= text color
aFillMode= FILLED or SKETCH
aText= the single line of text to draw.
aPos= the position of this line ).

Definition at line 465 of file eda_text.cpp.

468 {
469  wxDC* DC = aSettings->GetPrintDC();
470  int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
471 
472  if( aFillMode == SKETCH )
473  penWidth = -penWidth;
474 
475  wxSize size = GetTextSize();
476 
477  if( IsMirrored() )
478  size.x = -size.x;
479 
480  GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
481  GetVertJustify(), penWidth, IsItalic(), IsBold() );
482 }
bool IsBold() const
Definition: eda_text.h:189
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:195
double GetTextAngle() const
Definition: eda_text.h:180
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
bool IsItalic() const
Definition: eda_text.h:186
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
const wxSize & GetTextSize() const
Definition: eda_text.h:245
void GRText(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, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function GRText Draw a graphic text (like footprint texts)
Definition: gr_text.cpp:131
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 ( 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 178 of file eda_text.cpp.

179 {
180  bool retval = EDA_ITEM::Replace( aSearchData, m_text );
182  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
183 
184  return retval;
185 }
static bool Replace(wxFindReplaceData &aSearchData, wxString &aText)
Helper function used in search and replace dialog Function Replace performs a text replace on aText u...
Definition: eda_item.cpp:159
wxString m_shown_text
Definition: eda_text.h:378
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379
wxString m_text
Definition: eda_text.h:377
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

References m_shown_text, m_shown_text_has_text_var_refs, m_text, EDA_ITEM::Replace(), and UnescapeString().

Referenced by SCH_FIELD::Replace(), SCH_SHEET_PIN::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 137 of file eda_text.cpp.

138 {
139  m_e = aSrc.m_e;
140 }
TEXT_EFFECTS m_e
Definition: eda_text.h:381

References m_e.

Referenced by LIB_TEXT::Clone(), LIB_FIELD::Copy(), SCH_FIELD::ImportValues(), 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 208 of file eda_text.h.

208 { m_e.hjustify = aType; };
TEXT_EFFECTS m_e
Definition: eda_text.h:381
signed char hjustify
horizontal justification
Definition: eda_text.h:101

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(), FP_TEXT::Flip(), ALTIUM_PCB::HelperParseDimensions6Leader(), AUTOPLACER::justify_field(), FP_TEXT::KeepUpright(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_LEGACY_PLUGIN_CACHE::loadText(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), 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(), ALTIUM_PCB::ParseTexts6Data(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), LIB_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate90(), SetEdaTextJustification(), SCH_TEXT::SetLabelSpinStyle(), SCH_GLOBALLABEL::SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), PCAD2KICAD::SetTextJustify(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ 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 202 of file eda_text.h.

202 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

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

Referenced by PCB_TEXT::PCB_TEXT(), SCH_HIERLABEL::SCH_HIERLABEL(), SCH_LABEL::SCH_LABEL(), SCH_TEXT::SCH_TEXT(), and WS_DATA_ITEM_TEXT::SyncDrawItems().

◆ SetText()

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

Definition at line 121 of file eda_text.cpp.

122 {
123  m_text = aText;
124  m_shown_text = UnescapeString( aText );
125  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
126 }
wxString m_shown_text
Definition: eda_text.h:378
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379
wxString m_text
Definition: eda_text.h:377
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

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

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(), LIB_TEXT::Clone(), createBoard(), PCB_BASE_FRAME::CreateNewFootprint(), SYMBOL_EDIT_FRAME::CreateNewPart(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), dummy(), KIGFX::dummy(), SCH_EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), ALTIUM_PCB::HelperParseDimensions6Leader(), LIB_FIELD::HitTest(), SCH_EDIT_FRAME::importFile(), 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(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), 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(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), SCH_LEGACY_PLUGIN_CACHE::loadText(), TUNER_SLIDER::onSave(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), LIB_FIELD::operator=(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), 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(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), LIB_PART::PlotLibFields(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), CLIPBOARD_IO::SaveSelection(), LIB_PART::SetName(), SCH_COMPONENT::SetRef(), TEXT_MOD_GRID_TABLE::SetValue(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_LIB_EDIT_ONE_FIELD::UpdateField(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), SCH_COMPONENT::UpdateFields(), SCH_SHEET_LIST::UpdateSymbolInstances(), and DIMENSION_BASE::updateText().

◆ SetTextAngle()

virtual void EDA_TEXT::SetTextAngle ( double  aAngle)
inlinevirtual

Reimplemented in WS_DRAW_ITEM_TEXT, FP_TEXT, and PCB_TEXT.

Definition at line 173 of file eda_text.h.

174  {
175  // Higher level classes may be more restrictive than this by overloading
176  // SetTextAngle() or merely calling EDA_TEXT::SetTextAngle() after clamping
177  // aAngle before calling this lowest inline accessor.
178  m_e.angle = aAngle;
179  }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:105

References TEXT_EFFECTS::angle, and m_e.

Referenced by GRAPHICS_IMPORTER_PCBNEW::AddText(), SCH_GLOBALLABEL::AutoplaceFields(), eagleToKicadAlignment(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), LIB_FIELD::Init(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadLibraryFieldAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), SCH_LEGACY_PLUGIN_CACHE::loadText(), DIALOG_SHEET_PROPERTIES::OnAddField(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), ALTIUM_PCB::ParseTexts6Data(), SCH_EDIT_TOOL::Rotate(), LIB_TEXT::Rotate(), LIB_FIELD::Rotate(), SCH_GLOBALLABEL::Rotate90(), SetFieldOrientation(), SCH_TEXT::SetLabelSpinStyle(), SCH_GLOBALLABEL::SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), PCB_TEXT::SetTextAngle(), FP_TEXT::SetTextAngle(), WS_DRAW_ITEM_TEXT::SetTextAngle(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ SetTextHeight()

◆ SetTextPos()

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

Definition at line 253 of file eda_text.h.

253 { m_e.pos = aPoint; }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
wxPoint pos
Definition: eda_text.h:106

References m_e, and TEXT_EFFECTS::pos.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), SCH_GLOBALLABEL::AutoplaceFields(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_TEXT::CalcEdit(), LIB_FIELD::CalcEdit(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), FP_TEXT::FP_TEXT(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadLibraryFieldAttribute(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), 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(), LIB_TEXT::Rotate(), PCB_TEXT::Rotate(), FP_TEXT::Rotate(), SCH_FIELD::Rotate(), LIB_FIELD::Rotate(), DIMENSION_BASE::Rotate(), SCH_TEXT::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(), WS_DRAW_ITEM_TEXT::SetPosition(), SCH_TEXT::SetPosition(), SCH_COMPONENT::SetRef(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), SCH_COMPONENT::UpdateFields(), DIALOG_EDIT_ONE_FIELD::updateText(), ALIGNED_DIMENSION::updateText(), ORTHOGONAL_DIMENSION::updateText(), and WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT().

◆ SetTextSize()

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

Definition at line 244 of file eda_text.h.

244 { m_e.size = aNewSize; }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
wxSize size
Definition: eda_text.h:103

References m_e, and TEXT_EFFECTS::size.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), 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(), dummy(), KIGFX::dummy(), EDA_TEXT(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), LIB_TEXT::LIB_TEXT(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_LEGACY_PLUGIN::loadSheet(), SCH_LEGACY_PLUGIN_CACHE::loadText(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_FP_EDITOR::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(), DIMENSION_BASE::SetTextSize(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_GLOBALLABEL::UpdateIntersheetRefProps(), DIALOG_EDIT_ONE_FIELD::updateText(), and WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT().

◆ 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 164 of file eda_text.h.

164 { m_e.penwidth = aWidth; };
TEXT_EFFECTS m_e
Definition: eda_text.h:381
int penwidth
Definition: eda_text.h:104

References m_e, and TEXT_EFFECTS::penwidth.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), EDA_TEXT_DESC::EDA_TEXT_DESC(), FP_TEXT::FP_TEXT(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_FOOTPRINT_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(), TEXT_MOD_GRID_TABLE::SetValue(), LIB_TEXT::SetWidth(), LIB_FIELD::SetWidth(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), SCH_GLOBALLABEL::UpdateIntersheetRefProps(), and WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT().

◆ SetTextWidth()

◆ SetTextX()

◆ SetTextY()

void EDA_TEXT::SetTextY ( int  aY)
inline

◆ SetVertJustify()

void EDA_TEXT::SetVertJustify ( EDA_TEXT_VJUSTIFY_T  aType)
inline

◆ SetVisible()

void EDA_TEXT::SetVisible ( bool  aVisible)
inline

Definition at line 191 of file eda_text.h.

191 { m_e.Bit( TE_VISIBLE, aVisible ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:381
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

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(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), CADSTAR_SCH_ARCHIVE_LOADER::loadLibraryFieldAttribute(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), SCH_LEGACY_PLUGIN_CACHE::loadText(), 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_EDIT_FRAME::RecomputeIntersheetRefs(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), SCH_FIELD::SCH_FIELD(), TEXT_MOD_GRID_TABLE::SetValueAsBool(), SCH_EDIT_FRAME::ShowAllIntersheetRefs(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ ShortenedShownText()

wxString EDA_TEXT::ShortenedShownText ( ) const

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

Definition at line 202 of file eda_text.cpp.

203 {
204  wxString tmp = GetShownText();
205 
206  tmp.Replace( wxT( "\n" ), wxT( " " ) );
207  tmp.Replace( wxT( "\r" ), wxT( " " ) );
208  tmp.Replace( wxT( "\t" ), wxT( " " ) );
209 
210  if( tmp.Length() > 36 )
211  tmp = tmp.Left( 34 ) + wxT( "..." );
212 
213  return tmp;
214 }
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:140

References GetShownText().

Referenced by LIB_TEXT::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), SCH_FIELD::GetSelectMenuText(), LIB_FIELD::GetSelectMenuText(), SCH_SHEET_PIN::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 151 of file eda_text.cpp.

152 {
153  std::swap( m_e, aTradingPartner.m_e );
154 }
TEXT_EFFECTS m_e
Definition: eda_text.h:381

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 143 of file eda_text.cpp.

144 {
145  std::swap( m_text, aTradingPartner.m_text );
146  std::swap( m_shown_text, aTradingPartner.m_shown_text );
148 }
wxString m_shown_text
Definition: eda_text.h:378
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:379
wxString m_text
Definition: eda_text.h:377

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
aPoint-A wxPoint to test
aAccuracy- Amount to inflate the bounding box.
Returns
bool - true if a hit, else false

Reimplemented in FP_TEXT.

Definition at line 376 of file eda_text.cpp.

377 {
378  EDA_RECT rect = GetTextBox();
379  wxPoint location = aPoint;
380 
381  rect.Inflate( aAccuracy );
382  RotatePoint( &location, GetTextPos(), -GetTextAngle() );
383 
384  return rect.Contains( location );
385 }
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:223
double GetTextAngle() const
Definition: eda_text.h:180
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
bool Contains(const wxPoint &aPoint) const
Function Contains.
Definition: eda_rect.cpp:57
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

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

Referenced by LIB_TEXT::HitTest(), PCB_TEXT::HitTest(), LIB_FIELD::HitTest(), DIMENSION_BASE::HitTest(), and WS_DRAW_ITEM_TEXT::HitTest().

◆ 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
aRect- Rect to test against.
aContains- Test for containment instead of intersection if true.
aAccuracy- Amount to inflate the bounding box.
Returns
bool - true if a hit, else false

Reimplemented in FP_TEXT.

Definition at line 388 of file eda_text.cpp.

389 {
390  EDA_RECT rect = aRect;
391 
392  rect.Inflate( aAccuracy );
393 
394  if( aContains )
395  return rect.Contains( GetTextBox() );
396 
397  return rect.Intersects( GetTextBox(), GetTextAngle() );
398 }
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:223
double GetTextAngle() const
Definition: eda_text.h:180
bool Contains(const wxPoint &aPoint) const
Function Contains.
Definition: eda_rect.cpp:57
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

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
aCornerBuffer= a buffer to store the polygon
aClearanceValue= the clearance around the text bounding box to the real clearance value (usually near from 1.0)

Definition at line 349 of file board_items_to_polygon_shape_transform.cpp.

351 {
352  if( GetText().Length() == 0 )
353  return;
354 
355  wxPoint corners[4]; // Buffer of polygon corners
356 
357  EDA_RECT rect = GetTextBox();
358  rect.Inflate( aClearanceValue + Millimeter2iu( DEFAULT_TEXT_WIDTH ) );
359  corners[0].x = rect.GetOrigin().x;
360  corners[0].y = rect.GetOrigin().y;
361  corners[1].y = corners[0].y;
362  corners[1].x = rect.GetRight();
363  corners[2].x = corners[1].x;
364  corners[2].y = rect.GetBottom();
365  corners[3].y = corners[2].y;
366  corners[3].x = corners[0].x;
367 
368  aCornerBuffer->NewOutline();
369 
370  for( wxPoint& corner : corners )
371  {
372  // Rotate polygon
373  RotatePoint( &corner.x, &corner.y, GetTextPos().x, GetTextPos().y, GetTextAngle() );
374  aCornerBuffer->Append( corner.x, corner.y );
375  }
376 }
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:223
double GetTextAngle() const
Definition: eda_text.h:180
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int GetBottom() const
Definition: eda_rect.h:124
#define DEFAULT_TEXT_WIDTH
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
int GetRight() const
Definition: eda_rect.h:121
int NewOutline()
Creates a new empty polygon in the set and returns its index
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
static constexpr int Millimeter2iu(double mm)
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

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

Referenced by PCB_TEXT::TransformShapeWithClearanceToPolygon(), and FP_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 584 of file eda_text.cpp.

585 {
586  std::vector<wxPoint> cornerBuffer;
587  wxSize size = GetTextSize();
588 
589  if( IsMirrored() )
590  size.x = -size.x;
591 
592  bool forceBold = true;
593  int penWidth = 0; // use max-width for bold text
594 
595  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
596 
597  if( IsMultilineAllowed() )
598  {
599  wxArrayString strings_list;
600  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
601  std::vector<wxPoint> positions;
602  positions.reserve( strings_list.Count() );
603  GetLinePositions( positions, strings_list.Count() );
604 
605  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
606  {
607  wxString txt = strings_list.Item( ii );
608  GRText( NULL, positions[ii], color, txt, GetDrawRotation(), size, GetHorizJustify(),
609  GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
610  &cornerBuffer );
611  }
612  }
613  else
614  {
616  GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), forceBold,
617  addTextSegmToBuffer, &cornerBuffer );
618  }
619 
620  return cornerBuffer;
621 }
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:195
int color
Definition: DXF_plotter.cpp:60
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf, void *aData)
Definition: eda_text.cpp:576
virtual double GetDrawRotation() const
Definition: eda_text.cpp:637
Definition: color4d.h:45
bool IsItalic() const
Definition: eda_text.h:186
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
#define NULL
const wxSize & GetTextSize() const
Definition: eda_text.h:245
bool IsMultilineAllowed() const
Definition: eda_text.h:203
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:802
void GRText(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, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function GRText Draw a graphic text (like footprint texts)
Definition: gr_text.cpp:131
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:424
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:140
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100

References addTextSegmToBuffer(), BLACK, color, GetDrawRotation(), GetHorizJustify(), GetLinePositions(), GetShownText(), GetTextPos(), GetTextSize(), GetVertJustify(), GRText(), IsItalic(), IsMirrored(), IsMultilineAllowed(), NULL, 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 378 of file eda_text.h.

Referenced by CopyText(), EDA_TEXT(), GetShownText(), Replace(), SetText(), and SwapText().

◆ m_shown_text_has_text_var_refs

bool EDA_TEXT::m_shown_text_has_text_var_refs
private

Definition at line 379 of file eda_text.h.

Referenced by CopyText(), EDA_TEXT(), GetShownText(), Replace(), SetText(), and SwapText().

◆ m_text

wxString EDA_TEXT::m_text
private

Definition at line 377 of file eda_text.h.

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


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