KiCad PCB EDA Suite
Loading...
Searching...
No Matches
stroke_font.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 (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
5 * Copyright (C) 2013 CERN
6 * Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * @author Maciej Suminski <[email protected]>
9 *
10 * Stroke font class
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, you may find one here:
24 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25 * or you may search the http://www.gnu.org website for the version 2 license,
26 * or you may write to the Free Software Foundation, Inc.,
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28 */
29
30#ifndef STROKE_FONT_H
31#define STROKE_FONT_H
32
33#include <gal/gal.h>
34#include <map>
35#include <deque>
36#include <algorithm>
37#include <core/utf8.h>
38#include <math/box2.h>
39#include <font/font.h>
40
41namespace KIGFX
42{
43class GAL;
44}
45
46namespace KIFONT
47{
53class GAL_API STROKE_FONT : public FONT
54{
55public:
57
58 bool IsStroke() const override { return true; }
59
66 static STROKE_FONT* LoadFont( const wxString& aFontName );
67
72 double GetInterline( double aGlyphHeight, const METRICS& aFontMetrics ) const override;
73
74 VECTOR2I GetTextAsGlyphs( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
75 const wxString& aText, const VECTOR2I& aSize,
76 const VECTOR2I& aPosition, const EDA_ANGLE& aAngle, bool aMirror,
77 const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle ) const override;
78
79private:
86 void loadNewStrokeFont( const char* const aNewStrokeFont[], int aNewStrokeFontSize );
87
88private:
89 const std::vector<std::shared_ptr<GLYPH>>* m_glyphs;
90 const std::vector<BOX2D>* m_glyphBoundingBoxes;
92};
93
94} //namespace KIFONT
95
96#endif // STROKE_FONT_H
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:131
Implement a stroke font drawing.
Definition: stroke_font.h:54
bool IsStroke() const override
Definition: stroke_font.h:58
const std::vector< BOX2D > * m_glyphBoundingBoxes
Definition: stroke_font.h:90
const std::vector< std::shared_ptr< GLYPH > > * m_glyphs
Definition: stroke_font.h:89
unsigned int TEXT_STYLE_FLAGS
Definition: font.h:64
#define GAL_API
Definition: gal.h:28
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247