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, see <https://www.gnu.org/licenses/>.
24 */
25
26#ifndef STROKE_FONT_H
27#define STROKE_FONT_H
28
29#include <gal/gal.h>
30#include <map>
31#include <deque>
32#include <algorithm>
33#include <core/utf8.h>
34#include <math/box2.h>
35#include <font/font.h>
36
37namespace KIGFX
38{
39class GAL;
40}
41
42namespace KIFONT
43{
49class GAL_API STROKE_FONT : public FONT
50{
51public:
53
54 bool IsStroke() const override { return true; }
55
62 static STROKE_FONT* LoadFont( const wxString& aFontName );
63
69 double GetInterline( double aGlyphHeight, const METRICS& aFontMetrics ) const override;
70
71 VECTOR2I GetTextAsGlyphs( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
72 const wxString& aText, const VECTOR2I& aSize,
73 const VECTOR2I& aPosition, const EDA_ANGLE& aAngle, bool aMirror,
74 const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle ) const override;
75
76 unsigned GetGlyphCount() const;
77
78 const STROKE_GLYPH* GetGlyph( unsigned aIndex ) const;
79
80 const BOX2D& GetGlyphBoundingBox( unsigned aIndex ) const;
81
82private:
89 void loadNewStrokeFont( const char* const aNewStrokeFont[], int aNewStrokeFontSize );
90
91private:
92 const std::vector<std::shared_ptr<GLYPH>>* m_glyphs;
93 const std::vector<BOX2D>* m_glyphBoundingBoxes;
95};
96
97} //namespace KIFONT
98
99#endif // STROKE_FONT_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
BOX2< VECTOR2D > BOX2D
Definition box2.h:919
Implement a stroke font drawing.
Definition stroke_font.h:50
bool IsStroke() const override
Definition stroke_font.h:54
const std::vector< BOX2D > * m_glyphBoundingBoxes
Definition stroke_font.h:93
const std::vector< std::shared_ptr< GLYPH > > * m_glyphs
Definition stroke_font.h:92
Abstract interface for drawing on a 2D-surface.
unsigned int TEXT_STYLE_FLAGS
Definition font.h:61
#define GAL_API
Definition gal.h:27
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683