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 The 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
73 double GetInterline( double aGlyphHeight, const METRICS& aFontMetrics ) const override;
74
75 VECTOR2I GetTextAsGlyphs( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
76 const wxString& aText, const VECTOR2I& aSize,
77 const VECTOR2I& aPosition, const EDA_ANGLE& aAngle, bool aMirror,
78 const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle ) const override;
79
80 unsigned GetGlyphCount() const;
81
82 const STROKE_GLYPH* GetGlyph( unsigned aIndex ) const;
83
84 const BOX2D& GetGlyphBoundingBox( unsigned aIndex ) const;
85
86private:
93 void loadNewStrokeFont( const char* const aNewStrokeFont[], int aNewStrokeFontSize );
94
95private:
96 const std::vector<std::shared_ptr<GLYPH>>* m_glyphs;
97 const std::vector<BOX2D>* m_glyphBoundingBoxes;
99};
100
101} //namespace KIFONT
102
103#endif // STROKE_FONT_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
BOX2< VECTOR2D > BOX2D
Definition box2.h:923
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:97
const std::vector< std::shared_ptr< GLYPH > > * m_glyphs
Definition stroke_font.h:96
Abstract interface for drawing on a 2D-surface.
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 eda_group.h:33
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695