119 static const METRICS& Default();
140 virtual bool IsBold()
const {
return false; }
143 static FONT* GetFont(
const wxString& aFontName = wxEmptyString,
bool aBold =
false,
144 bool aItalic =
false,
145 const std::vector<wxString>* aEmbeddedFiles =
nullptr,
146 bool aForDrawingSheet =
false );
147 static bool IsStroke(
const wxString& aFontName );
166 const METRICS& aFontMetrics, std::optional<VECTOR2I> aMousePos = std::nullopt,
167 wxString* aActiveUrl =
nullptr )
const;
171 std::optional<VECTOR2I> aMousePos = std::nullopt, wxString* aActiveUrl =
nullptr )
const
173 Draw( aGal, aText, aPosition,
VECTOR2I( 0, 0 ), aAttributes, aFontMetrics, aMousePos, aActiveUrl );
181 VECTOR2I StringBoundaryLimits(
const wxString& aText,
const VECTOR2I& aSize,
int aThickness,
182 bool aBold,
bool aItalic,
const METRICS& aFontMetrics )
const;
197 void LinebreakText( wxString& aText,
int aColumnWidth,
const VECTOR2I& aGlyphSize,
198 int aThickness,
bool aBold,
bool aItalic )
const;
221 const wxString& aText,
const VECTOR2I& aSize,
223 bool aMirror,
const VECTOR2I& aOrigin,
239 return std::count( aText.begin(), aText.end() - 1,
'\n' ) + 1;
259 void drawSingleLineText(
KIGFX::GAL* aGal,
BOX2I* aBoundingBox,
const wxString& aText,
262 bool aItalic,
bool aUnderline,
bool aHover,
const METRICS& aFontMetrics,
263 std::optional<VECTOR2I> aMousePos, wxString* aActiveUrl )
const;
277 const VECTOR2I& aSize,
bool aItalic,
278 const METRICS& aFontMetrics )
const;
280 void getLinePositions(
const wxString& aText,
const VECTOR2I& aPosition,
281 wxArrayString& aTextLines, std::vector<VECTOR2I>& aPositions,
283 const METRICS& aFontMetrics )
const;
286 const wxString& aText,
const VECTOR2I& aPosition,
289 const METRICS& aFontMetrics, std::optional<VECTOR2I> aMousePos = std::nullopt,
290 wxString* aActiveUrl =
nullptr )
const;
292 void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords,
const wxString& aText,
296 static FONT* getDefaultFont();
313 os <<
"[Font \"" << aFont.
GetName() <<
"\"" << ( aFont.
IsStroke() ?
" stroke" :
"" )
314 << ( aFont.
IsOutline() ?
" outline" :
"" ) << ( aFont.
IsBold() ?
" bold" :
"" )
315 << ( aFont.
IsItalic() ?
" italic" :
"" ) <<
"]";
FONT is an abstract base class for both outline and stroke fonts.
wxString m_fontName
Font name.
wxString m_fontFileName
Font file name.
virtual bool IsStroke() const
static FONT * s_defaultFont
const char * NameAsToken() const
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) const
Draw a string.
virtual bool IsItalic() const
virtual bool IsBold() const
const wxString & GetName() const
virtual bool IsOutline() const
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) const
static std::map< std::tuple< wxString, bool, bool, bool >, FONT * > s_fontMap
virtual double GetInterline(double aGlyphHeight, const METRICS &aFontMetrics) const =0
Compute the distance (interline) between 2 lines of text (for multiline texts).
unsigned linesCount(const wxString &aText) const
Return number of lines for a given text.
virtual VECTOR2I GetTextAsGlyphs(BOX2I *aBBox, std::vector< std::unique_ptr< GLYPH > > *aGlyphs, const wxString &aText, const VECTOR2I &aSize, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle, bool aMirror, const VECTOR2I &aOrigin, TEXT_STYLE_FLAGS aTextStyle) const =0
Convert text string to an array of GLYPHs.
double GetUnderlineVerticalPosition(double aGlyphHeight) const
Compute the vertical position of an underline.
double GetOverbarVerticalPosition(double aGlyphHeight) const
Compute the vertical position of an overbar.
double GetInterline(double aFontHeight) const
Abstract interface for drawing on a 2D-surface.
void wordbreakMarkup(std::vector< std::pair< wxString, int > > *aWords, const std::unique_ptr< MARKUP::NODE > &aNode, const KIFONT::FONT *aFont, const VECTOR2I &aSize, TEXT_STYLE_FLAGS aTextStyle)
Break marked-up text into "words".
VECTOR2I drawMarkup(BOX2I *aBoundingBox, std::vector< std::unique_ptr< GLYPH > > *aGlyphs, const MARKUP::NODE *aNode, const VECTOR2I &aPosition, const KIFONT::FONT *aFont, const VECTOR2I &aSize, const EDA_ANGLE &aAngle, bool aMirror, const VECTOR2I &aOrigin, TEXT_STYLE_FLAGS aTextStyle, const METRICS &aFontMetrics, std::optional< VECTOR2I > aMousePos, wxString *aActiveUrl)
unsigned int TEXT_STYLE_FLAGS
bool IsBold(TEXT_STYLE_FLAGS aFlags)
bool IsSuperscript(TEXT_STYLE_FLAGS aFlags)
bool IsItalic(TEXT_STYLE_FLAGS aFlags)
static constexpr double ITALIC_TILT
Tilt factor for italic style (this is the scaling factor on dY relative coordinates to give a tilted ...
bool IsSubscript(TEXT_STYLE_FLAGS aFlags)
std::ostream & operator<<(std::ostream &os, const KIFONT::FONT &aFont)
The Cairo implementation of the graphics abstraction layer.
VECTOR2< int32_t > VECTOR2I