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 641 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 652 of file eagle_parser.h.

652 { // for align
653 CENTER = 0,
656 TOP_LEFT,
657 TOP_RIGHT,
658
659 // opposites are -1 x above, used by code tricks in here
664 };
@ BOTTOM_CENTER
Definition: eagle_parser.h:661
@ BOTTOM_RIGHT
Definition: eagle_parser.h:663
@ TOP_CENTER
Definition: eagle_parser.h:655
@ TOP_LEFT
Definition: eagle_parser.h:656
@ TOP_RIGHT
Definition: eagle_parser.h:657
@ CENTER_RIGHT
Definition: eagle_parser.h:660
@ CENTER_LEFT
Definition: eagle_parser.h:654
@ BOTTOM_LEFT
Definition: eagle_parser.h:662

Constructor & Destructor Documentation

◆ ETEXT()

ETEXT::ETEXT ( wxXmlNode *  aText)

Definition at line 650 of file eagle_parser.cpp.

651{
652 /*
653 <!ELEMENT text (#PCDATA)>
654 <!ATTLIST text
655 x %Coord; #REQUIRED
656 y %Coord; #REQUIRED
657 size %Dimension; #REQUIRED
658 layer %Layer; #REQUIRED
659 font %TextFont; "proportional"
660 ratio %Int; "8"
661 rot %Rotation; "R0"
662 align %Align; "bottom-left"
663 >
664 */
665
666 text = aText->GetNodeContent();
667 x = parseRequiredAttribute<ECOORD>( aText, "x" );
668 y = parseRequiredAttribute<ECOORD>( aText, "y" );
669 size = parseRequiredAttribute<ECOORD>( aText, "size" );
670 layer = parseRequiredAttribute<int>( aText, "layer" );
671
672 font = parseOptionalAttribute<wxString>( aText, "font" );
673 ratio = parseOptionalAttribute<double>( aText, "ratio" );
674 rot = parseOptionalAttribute<EROT>( aText, "rot" );
675
676 opt_wxString stemp = parseOptionalAttribute<wxString>( aText, "align" );
677
678 align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
679}
static int parseAlignment(const wxString &aAlignment)
constexpr auto DEFAULT_ALIGNMENT
opt_double ratio
Definition: eagle_parser.h:649
wxString text
Definition: eagle_parser.h:643
ECOORD y
Definition: eagle_parser.h:645
ECOORD size
Definition: eagle_parser.h:646
opt_erot rot
Definition: eagle_parser.h:650
opt_int align
Definition: eagle_parser.h:666
ECOORD x
Definition: eagle_parser.h:644
opt_wxString font
Definition: eagle_parser.h:648
int layer
Definition: eagle_parser.h:647

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 682 of file eagle_parser.cpp.

683{
684 wxSize textsize;
685
686 if( font )
687 {
688 const wxString& fontName = font.CGet();
689
690 if( fontName == "vector" )
691 {
692 textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
693 }
694 else if( fontName == "fixed" )
695 {
696 textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() * 0.80 );
697 }
698 else
699 {
700 textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
701 }
702 }
703 else
704 {
705 textsize = wxSize( size.ToSchUnits() * 0.85, size.ToSchUnits() );
706 }
707
708 return textsize;
709}
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:309
int ToSchUnits() const
Definition: eagle_parser.h:435

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 648 of file eagle_parser.h.

Referenced by ConvertSize(), and ETEXT().

◆ layer

int ETEXT::layer

Definition at line 647 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 643 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: