KiCad PCB EDA Suite
ETEXT Struct Reference

Eagle text element. More...

#include <eagle_parser.h>

Public Types

enum  {
  CENTER, 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 643 of file eagle_parser.h.

Member Enumeration Documentation

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

Definition at line 654 of file eagle_parser.h.

654  { // for align
655  CENTER,
656  CENTER_LEFT,
657  TOP_CENTER,
658  TOP_LEFT,
659  TOP_RIGHT,
660 
661  // opposites are -1 x above, used by code tricks in here
666  };

Constructor & Destructor Documentation

ETEXT::ETEXT ( wxXmlNode *  aText)

Definition at line 561 of file eagle_parser.cpp.

References DEFAULT_ALIGNMENT, and parseAlignment().

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

Member Function Documentation

wxSize ETEXT::ConvertSize ( ) const

Calculate text size based on font type and size.

Definition at line 593 of file eagle_parser.cpp.

Referenced by SCH_EAGLE_PLUGIN::loadTextAttributes().

594 {
595  wxSize textsize;
596 
597  if( font )
598  {
599  const wxString& fontName = font.CGet();
600 
601  if( fontName == "vector" )
602  {
603  textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
604  }
605  else if( fontName == "fixed" )
606  {
607  textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() * 0.80 );
608  }
609  else
610  {
611  wxASSERT( false );
612  textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
613  }
614  }
615  else
616  {
617  textsize = wxSize( size.ToSchUnits() * 0.85, size.ToSchUnits() );
618  }
619 
620  return textsize;
621 }
ECOORD size
Definition: eagle_parser.h:648
opt_wxString font
Definition: eagle_parser.h:650
const T & CGet() const
Function CGet returns a constant reference to the value of the attribute assuming it is available...
Definition: eagle_parser.h:310
int ToSchUnits() const
Definition: eagle_parser.h:422

Member Data Documentation

opt_wxString ETEXT::font

Definition at line 650 of file eagle_parser.h.

int ETEXT::layer

Definition at line 649 of file eagle_parser.h.

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

ECOORD ETEXT::size

Definition at line 648 of file eagle_parser.h.

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

wxString ETEXT::text

Definition at line 645 of file eagle_parser.h.

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


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