47#define TEXT_MIN_SIZE_MM 0.001
48#define TEXT_MAX_SIZE_MM 250.0
70#define DEFAULT_SIZE_TEXT 50
90 void Serialize( google::protobuf::Any &aContainer )
const override;
91 bool Deserialize(
const google::protobuf::Any &aContainer )
override;
109 virtual wxString
GetShownText(
bool aAllowExtraText,
int aDepth = 0 )
const
119 virtual void SetText(
const wxString& aText );
307 virtual bool TextHitTest(
const BOX2I& aRect,
bool aContains,
int aAccuracy = 0 )
const;
341 void GetLinePositions( std::vector<VECTOR2I>& aPositions,
int aLineCount )
const;
368 std::vector<std::unique_ptr<KIFONT::GLYPH>>*
370 const VECTOR2I& aOffset = { 0, 0 } )
const;
404 static bool IsGotoPageHref(
const wxString& aHref, wxString* aDestination =
nullptr );
412 static wxString
GotoPageHref(
const wxString& aDestination );
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
int GetTextHeight() const
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetTextColor(const COLOR4D &aColor)
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
wxString GetTextStyleName() const
bool IsDefaultFormatting() const
static bool IsGotoPageHref(const wxString &aHref, wxString *aDestination=nullptr)
Check if aHref is a valid internal hyperlink.
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_render_cache
wxString GetFontName() const
const EDA_ANGLE & GetTextAngle() const
BOX2I m_bounding_box_cache
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
bool IsMultilineAllowed() const
virtual const wxString & GetText() const
Return the string associated with the text object.
int GetInterline() const
Return the distance between two lines of text.
bool IsKeepUpright() const
virtual bool IsVisible() const
void SetTextPos(const VECTOR2I &aPoint)
bool m_shown_text_has_text_var_refs
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
KIFONT::FONT * GetFont() const
void SetAttributes(const TEXT_ATTRIBUTES &aTextAttrs)
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
BOX2I GetTextBox(int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
void SetMirrored(bool isMirrored)
int m_bounding_box_cache_line
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
const KIFONT::FONT * m_render_cache_font
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
EDA_TEXT & operator=(const EDA_TEXT &aItem)
wxString m_hyperlink
A hyperlink URL.
void printOneLineOfText(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const VECTOR2I &aPos)
Print each line of this EDA_TEXT.
virtual bool HasHyperlink() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
wxString GetHyperlink() const
void Offset(const VECTOR2I &aOffset)
virtual void Format(OUTPUTFORMATTER *aFormatter, int aControlBits) const
Output the object to aFormatter in s-expression form.
GR_TEXT_H_ALIGN_T GetHorizJustify() const
void SetTextWidth(int aWidth)
void SetBoldFlag(bool aBold)
Set only the italic flag, without changing the font.
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
void SetupRenderCache(const wxString &aResolvedText, const KIFONT::FONT *aFont, const EDA_ANGLE &aAngle, const VECTOR2I &aOffset)
int Compare(const EDA_TEXT *aOther) const
std::reference_wrapper< const EDA_IU_SCALE > m_IuScale
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
bool operator>(const EDA_TEXT &aRhs) const
virtual void SetVisible(bool aVisible)
bool m_bounding_box_cache_valid
void GetLinePositions(std::vector< VECTOR2I > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
static wxString GotoPageHref(const wxString &aDestination)
Generate a href to a page in the current schematic.
virtual void ClearBoundingBoxCache()
virtual KIFONT::FONT * getDrawFont() const
double GetLineSpacing() const
double Similarity(const EDA_TEXT &aOther) const
VECTOR2I m_render_cache_offset
void SetLineSpacing(double aLineSpacing)
void AddRenderCacheGlyph(const SHAPE_POLY_SET &aPoly)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
virtual bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
void SetTextHeight(int aHeight)
virtual void cacheShownText()
EDA_ANGLE m_render_cache_angle
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
virtual void ClearRenderCache()
const TEXT_ATTRIBUTES & GetAttributes() const
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
static bool ValidateHyperlink(const wxString &aURL)
Check if aURL is a valid hyperlink.
VECTOR2I m_bounding_box_cache_pos
void SetItalicFlag(bool aItalic)
Set only the italic flag, without changing the font.
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
void SwapAttributes(EDA_TEXT &aTradingPartner)
Swap the text attributes of the two involved instances.
wxString m_render_cache_text
double GetTextAngleDegrees() const
virtual const KIFONT::METRICS & getFontMetrics() const
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, const BOX2I &aBBox=BOX2I(), const EDA_ANGLE &aAngle=ANGLE_0) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
bool operator<(const EDA_TEXT &aRhs) const
void SetTextAngleDegrees(double aOrientation)
void SetHyperlink(wxString aLink)
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
void SetKeepUpright(bool aKeepUpright)
void CopyText(const EDA_TEXT &aSrc)
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
virtual void SetText(const wxString &aText)
double Levenshtein(const EDA_TEXT &aOther) const
Return the levenstein distance between two texts.
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetFontIndex(int aIdx)
int GetTextThickness() const
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SwapText(EDA_TEXT &aTradingPartner)
bool operator==(const EDA_TEXT &aRhs) const
void SetMultilineAllowed(bool aAllow)
void SetFont(KIFONT::FONT *aFont)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
TEXT_ATTRIBUTES m_attributes
FONT is an abstract base class for both outline and stroke fonts.
A color representation with 4 components: red, green, blue, alpha.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Interface for objects that can be serialized to Protobuf messages.
Represent a set of closed polygons.
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
static constexpr EDA_ANGLE ANGLE_0
std::ostream & operator<<(std::ostream &aStream, const EDA_TEXT &aText)
static constexpr std::size_t hash_val(const Types &... args)
The Cairo implementation of the graphics abstraction layer.
std::size_t operator()(const EDA_TEXT &aText) const