KiCad PCB EDA Suite
ETEXT Struct Reference

Eagle text element. More...

#include <eagle_parser.h>

Public Types

enum  {
  CENTER = 0, CENTER_LEFT, TOP_CENTER, TOP_LEFT,
  TOP_RIGHT, CENTER_RIGHT = -CENTER_LEFT, BOTTOM_CENTER = -TOP_CENTER, BOTTOM_LEFT = -TOP_RIGHT,
  BOTTOM_RIGHT = -TOP_LEFT
}
 

Public Member Functions

 ETEXT (wxXmlNode *aText)
 
wxSize ConvertSize () const
 Calculate text size based on font type and size. More...
 

Public Attributes

wxString text
 
ECOORD x
 
ECOORD y
 
ECOORD size
 
int layer
 
opt_wxString font
 
opt_double ratio
 
opt_erot rot
 
opt_int align
 

Detailed Description

Eagle text element.

Definition at line 637 of file eagle_parser.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
CENTER 
CENTER_LEFT 
TOP_CENTER 
TOP_LEFT 
TOP_RIGHT 
CENTER_RIGHT 
BOTTOM_CENTER 
BOTTOM_LEFT 
BOTTOM_RIGHT 

Definition at line 648 of file eagle_parser.h.

648  { // for align
649  CENTER = 0,
650  CENTER_LEFT,
651  TOP_CENTER,
652  TOP_LEFT,
653  TOP_RIGHT,
654 
655  // opposites are -1 x above, used by code tricks in here
660  };

Constructor & Destructor Documentation

◆ ETEXT()

ETEXT::ETEXT ( wxXmlNode *  aText)

Definition at line 559 of file eagle_parser.cpp.

560 {
561  /*
562  <!ELEMENT text (#PCDATA)>
563  <!ATTLIST text
564  x %Coord; #REQUIRED
565  y %Coord; #REQUIRED
566  size %Dimension; #REQUIRED
567  layer %Layer; #REQUIRED
568  font %TextFont; "proportional"
569  ratio %Int; "8"
570  rot %Rotation; "R0"
571  align %Align; "bottom-left"
572  >
573  */
574 
575  text = aText->GetNodeContent();
576  x = parseRequiredAttribute<ECOORD>( aText, wxT( "x" ) );
577  y = parseRequiredAttribute<ECOORD>( aText, wxT( "y" ) );
578  size = parseRequiredAttribute<ECOORD>( aText, wxT( "size" ) );
579  layer = parseRequiredAttribute<int>( aText, wxT( "layer" ) );
580 
581  font = parseOptionalAttribute<wxString>( aText, wxT( "font" ) );
582  ratio = parseOptionalAttribute<double>( aText, wxT( "ratio" ) );
583  rot = parseOptionalAttribute<EROT>( aText, wxT( "rot" ) );
584 
585  opt_wxString stemp = parseOptionalAttribute<wxString>( aText, wxT( "align" ) );
586 
587  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
588 }
opt_double ratio
Definition: eagle_parser.h:645
ECOORD x
Definition: eagle_parser.h:640
ECOORD size
Definition: eagle_parser.h:642
wxString text
Definition: eagle_parser.h:639
opt_int align
Definition: eagle_parser.h:662
static int parseAlignment(const wxString &aAlignment)
opt_erot rot
Definition: eagle_parser.h:646
opt_wxString font
Definition: eagle_parser.h:644
constexpr auto DEFAULT_ALIGNMENT
ECOORD y
Definition: eagle_parser.h:641
int layer
Definition: eagle_parser.h:643

References align, DEFAULT_ALIGNMENT, font, layer, parseAlignment(), ratio, rot, size, text, x, and y.

Member Function Documentation

◆ ConvertSize()

wxSize ETEXT::ConvertSize ( ) const

Calculate text size based on font type and size.

Definition at line 591 of file eagle_parser.cpp.

592 {
593  wxSize textsize;
594 
595  if( font )
596  {
597  const wxString& fontName = font.CGet();
598 
599  if( fontName == wxT( "vector" ) )
600  {
601  textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
602  }
603  else if( fontName == wxT( "fixed" ) )
604  {
605  textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() * 0.80 );
606  }
607  else
608  {
609  textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
610  }
611  }
612  else
613  {
614  textsize = wxSize( size.ToSchUnits() * 0.85, size.ToSchUnits() );
615  }
616 
617  return textsize;
618 }
int ToSchUnits() const
Definition: eagle_parser.h:429
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:303
ECOORD size
Definition: eagle_parser.h:642
opt_wxString font
Definition: eagle_parser.h:644

References OPTIONAL_XML_ATTRIBUTE< T >::CGet(), font, size, and ECOORD::ToSchUnits().

Referenced by SCH_EAGLE_PLUGIN::loadTextAttributes().

Member Data Documentation

◆ align

◆ font

opt_wxString ETEXT::font

Definition at line 644 of file eagle_parser.h.

Referenced by ConvertSize(), and ETEXT().

◆ layer

int ETEXT::layer

Definition at line 643 of file eagle_parser.h.

Referenced by ETEXT(), EAGLE_PLUGIN::loadPlain(), and EAGLE_PLUGIN::packageText().

◆ ratio

◆ rot

◆ size

ECOORD ETEXT::size

◆ text

wxString ETEXT::text

Definition at line 639 of file eagle_parser.h.

Referenced by ETEXT(), EAGLE_PLUGIN::loadPlain(), and EAGLE_PLUGIN::packageText().

◆ x

◆ y


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