KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::TEXT_AND_ICON_LAYOUT Class Reference

Small helper class to figure out the layout of text and text-adjacent icons, including text shadows and offsets. More...

Classes

struct  LOCATIONS
 

Public Member Functions

 TEXT_AND_ICON_LAYOUT (KIGFX::GAL &aGal, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics, const double aShadowWidth, const double aIconSize=0)
 Create a new layout helper.
 
LOCATIONS getTextLayout (const wxString &aText, const VECTOR2I &aPos, GR_TEXT_H_ALIGN_T aIconSide, std::size_t aNIcons, bool aDrawShadow)
 Get the layout of text and icons for a given text string at a position.
 

Private Attributes

const TEXT_ATTRIBUTESm_attrs
 
const KIFONT::METRICSm_fontMetrics
 
double m_iconSize
 
double m_iconGap
 
double m_shadowWidth
 
double m_shadowOffset
 

Detailed Description

Small helper class to figure out the layout of text and text-adjacent icons, including text shadows and offsets.

Definition at line 871 of file sch_painter.cpp.

Constructor & Destructor Documentation

◆ TEXT_AND_ICON_LAYOUT()

KIGFX::TEXT_AND_ICON_LAYOUT::TEXT_AND_ICON_LAYOUT ( KIGFX::GAL aGal,
const TEXT_ATTRIBUTES aAttrs,
const KIFONT::METRICS aFontMetrics,
const double  aShadowWidth,
const double  aIconSize = 0 
)
inline

Create a new layout helper.

Definition at line 878 of file sch_painter.cpp.

References KIGFX::eeconfig(), KIFONT::FONT::GetFont(), and KIFONT::FONT::IsOutline().

Member Function Documentation

◆ getTextLayout()

LOCATIONS KIGFX::TEXT_AND_ICON_LAYOUT::getTextLayout ( const wxString &  aText,
const VECTOR2I aPos,
GR_TEXT_H_ALIGN_T  aIconSide,
std::size_t  aNIcons,
bool  aDrawShadow 
)
inline

Get the layout of text and icons for a given text string at a position.

It will return the position of the text and the icons, as well as the computed shadow text position.

Definition at line 914 of file sch_painter.cpp.

References ANGLE_HORIZONTAL, DIRECTION_45::E, KIGEOM::GetPoint(), KIGFX::GetTextExtents(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, DIRECTION_45::N, DIRECTION_45::S, and DIRECTION_45::W.

Referenced by KIGFX::SCH_PAINTER::draw().

Member Data Documentation

◆ m_attrs

const TEXT_ATTRIBUTES& KIGFX::TEXT_AND_ICON_LAYOUT::m_attrs
private

Definition at line 968 of file sch_painter.cpp.

◆ m_fontMetrics

const KIFONT::METRICS& KIGFX::TEXT_AND_ICON_LAYOUT::m_fontMetrics
private

Definition at line 969 of file sch_painter.cpp.

◆ m_iconGap

double KIGFX::TEXT_AND_ICON_LAYOUT::m_iconGap
private

Definition at line 971 of file sch_painter.cpp.

◆ m_iconSize

double KIGFX::TEXT_AND_ICON_LAYOUT::m_iconSize
private

Definition at line 970 of file sch_painter.cpp.

◆ m_shadowOffset

double KIGFX::TEXT_AND_ICON_LAYOUT::m_shadowOffset
private

Definition at line 973 of file sch_painter.cpp.

◆ m_shadowWidth

double KIGFX::TEXT_AND_ICON_LAYOUT::m_shadowWidth
private

Definition at line 972 of file sch_painter.cpp.


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