KiCad PCB EDA Suite
Loading...
Searching...
No Matches
target3001_fonts.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef TARGET3001_FONTS_H
21#define TARGET3001_FONTS_H
22
23#include <map>
24#include <tuple>
25
26#include <math/vector2d.h>
27#include <wx/string.h>
28
29class EDA_TEXT;
30
31namespace KIFONT
32{
33class OUTLINE_FONT;
34}
35
36namespace TARGET3001
37{
38
39struct ELEMENT;
40
54class FONTS
55{
56public:
64 void Apply( EDA_TEXT* aText, const ELEMENT& aElem, int aUnit );
65
74 static VECTOR2I BaselineShift( const EDA_TEXT& aText );
75
76private:
77 bool applyTrueType( EDA_TEXT* aText, const ELEMENT& aElem, int aUnit );
78
79 std::map<std::tuple<wxString, bool, bool>, KIFONT::OUTLINE_FONT*> m_fonts;
80 std::map<const KIFONT::OUTLINE_FONT*, double> m_averageWidth;
81};
82
83} // namespace TARGET3001
84
85#endif // TARGET3001_FONTS_H
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
Implement outline font drawing.
Maps TARGET 3001!
bool applyTrueType(EDA_TEXT *aText, const ELEMENT &aElem, int aUnit)
static VECTOR2I BaselineShift(const EDA_TEXT &aText)
Offset in text units that moves aText so the baseline-left point of its first glyph lies on its posit...
std::map< std::tuple< wxString, bool, bool >, KIFONT::OUTLINE_FONT * > m_fonts
std::map< const KIFONT::OUTLINE_FONT *, double > m_averageWidth
per unit of text size
void Apply(EDA_TEXT *aText, const ELEMENT &aElem, int aUnit)
Give aText the font, style, size and stroke width of text aElem.
Reader for TARGET 3001!
One element of any class.
One element of any class.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708