|
KiCad PCB EDA Suite
|
#include <easypc_text_metrics.h>
Public Member Functions | |
| TEXT_METRICS (const SOURCE_TEXT_STYLE &aStyle) | |
| bool | CanMeasure () const |
| False for a TrueType style; the measuring calls throw IO_ERROR for one. | |
| int32_t | Height () const |
| int32_t | RunWidth (const std::string &aText, size_t aBegin, size_t aEnd) const |
| Width of bytes [aBegin, aEnd); a run that measures 0 is one height wide. | |
| BOX2I | TextBox (const wxString &aText, const VECTOR2I &aAnchor, int32_t aAngle, bool aMirrored, int aHAlign, int aVAlign=TEXT_V_BASELINE) const |
| Every line's cell, inflated by half the pen width, mirrored about the anchor and bounded after rotation. | |
| VECTOR2I | UprightAnchor (const wxString &aText, const VECTOR2I &aAnchor, int32_t aAngle, bool aMirrored, int aHAlign, bool aKeepUpright) const |
| When aKeepUpright and UprightRotation turns the text, the anchor moves to the far end of the first line one height up, then is mirrored and rotated with it; otherwise it is unchanged. | |
Static Public Member Functions | |
| static std::string | Encode (const wxString &aText) |
| The CP1252 bytes of aText; characters CP1252 lacks become 0. | |
Private Member Functions | |
| void | checkMeasurable () const |
| int32_t | linePitch () const |
| int32_t | charWidth (char aChar) const |
Private Attributes | |
| int32_t | m_height = 0 |
| int32_t | m_penWidth = 0 |
| int32_t | m_interlinePercent = 120 |
| int32_t | m_charWidthPercent = 100 |
| bool | m_proportional = false |
| bool | m_typeFont = false |
Definition at line 67 of file easypc_text_metrics.h.
|
explicit |
Definition at line 116 of file easypc_text_metrics.cpp.
References Height(), EASYPC::SOURCE_TEXT_STYLE::LineWidth, m_charWidthPercent, m_height, m_interlinePercent, m_penWidth, m_proportional, and m_typeFont.
|
inline |
False for a TrueType style; the measuring calls throw IO_ERROR for one.
Definition at line 73 of file easypc_text_metrics.h.
References m_typeFont.
Referenced by EASYPC::SCH_BUILDER::computeOffset(), and EASYPC::DrawsUpright().
|
private |
Definition at line 141 of file easypc_text_metrics.cpp.
References m_charWidthPercent, m_height, and m_proportional.
Referenced by RunWidth().
|
private |
Definition at line 128 of file easypc_text_metrics.cpp.
References _, m_typeFont, and THROW_IO_ERROR.
Referenced by RunWidth().
|
static |
The CP1252 bytes of aText; characters CP1252 lacks become 0.
Definition at line 300 of file easypc_text_metrics.cpp.
Referenced by EASYPC_PCB::ApplyTextPosition(), and TextBox().
|
inline |
Definition at line 75 of file easypc_text_metrics.h.
References m_height.
Referenced by TEXT_METRICS().
|
private |
Definition at line 135 of file easypc_text_metrics.cpp.
References m_height, and m_interlinePercent.
Referenced by TextBox().
| int32_t EASYPC::TEXT_METRICS::RunWidth | ( | const std::string & | aText, |
| size_t | aBegin, | ||
| size_t | aEnd ) const |
Width of bytes [aBegin, aEnd); a run that measures 0 is one height wide.
Definition at line 152 of file easypc_text_metrics.cpp.
References charWidth(), checkMeasurable(), and m_height.
Referenced by TextBox().
| BOX2I EASYPC::TEXT_METRICS::TextBox | ( | const wxString & | aText, |
| const VECTOR2I & | aAnchor, | ||
| int32_t | aAngle, | ||
| bool | aMirrored, | ||
| int | aHAlign, | ||
| int | aVAlign = TEXT_V_BASELINE ) const |
Every line's cell, inflated by half the pen width, mirrored about the anchor and bounded after rotation.
An empty string gives an empty box.
Definition at line 165 of file easypc_text_metrics.cpp.
References Encode(), end, left, linePitch(), m_height, m_penWidth, RunWidth(), BOX2< Vec >::SetEnd(), text, EASYPC::TEXT_H_CENTRE, EASYPC::TEXT_H_RIGHT, EASYPC::TEXT_V_MIDDLE, EASYPC::TEXT_V_TOP, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by EASYPC::SCH_BUILDER::computeOffset(), and UprightAnchor().
| VECTOR2I EASYPC::TEXT_METRICS::UprightAnchor | ( | const wxString & | aText, |
| const VECTOR2I & | aAnchor, | ||
| int32_t | aAngle, | ||
| bool | aMirrored, | ||
| int | aHAlign, | ||
| bool | aKeepUpright ) const |
When aKeepUpright and UprightRotation turns the text, the anchor moves to the far end of the first line one height up, then is mirrored and rotated with it; otherwise it is unchanged.
Definition at line 278 of file easypc_text_metrics.cpp.
References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), m_height, m_penWidth, EASYPC::TEXT_H_LEFT, TextBox(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by EASYPC::ApplyTextPosition().
|
private |
Definition at line 105 of file easypc_text_metrics.h.
Referenced by charWidth(), and TEXT_METRICS().
|
private |
Definition at line 102 of file easypc_text_metrics.h.
Referenced by charWidth(), Height(), linePitch(), RunWidth(), TEXT_METRICS(), TextBox(), and UprightAnchor().
|
private |
Definition at line 104 of file easypc_text_metrics.h.
Referenced by linePitch(), and TEXT_METRICS().
|
private |
Definition at line 103 of file easypc_text_metrics.h.
Referenced by TEXT_METRICS(), TextBox(), and UprightAnchor().
|
private |
Definition at line 106 of file easypc_text_metrics.h.
Referenced by charWidth(), and TEXT_METRICS().
|
private |
Definition at line 107 of file easypc_text_metrics.h.
Referenced by CanMeasure(), checkMeasurable(), and TEXT_METRICS().