KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gl_resources.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 GAL_OPENGL_RESOURCES_H___
21#define GAL_OPENGL_RESOURCES_H___
22
23#include <gal/gal.h>
24#include <math/vector2d.h>
25#include <utility>
26
27class UTF8;
28
29#define BITMAP_FONT_USE_SPANS
30
31namespace KIGFX {
32
33 namespace BUILTIN_FONT {
34
36 {
37 unsigned int width, height;
38 unsigned int char_border;
39 unsigned int spacing;
40 // Height must match the atlas in bitmap_font_img.c
41 unsigned char pixels[1024 * 1107 * 3];
42 };
43
45 {
46 unsigned int smooth_pixels;
47 float min_y;
48 float max_y;
49 };
50
52 {
53 unsigned int start;
54 unsigned int end;
55 unsigned int cumulative;
56 };
57
59 {
60 unsigned int atlas_x, atlas_y;
61 unsigned int atlas_w, atlas_h;
62 float minx, maxx;
63 float miny, maxy;
64 float advance;
65 };
66
69
71 struct GLYPH_BOX
72 {
73 float x, y;
74 float w, h;
75 float atlasX, atlasY;
76 };
77
78 GAL_API const FONT_GLYPH_TYPE* LookupGlyph( unsigned int aCodePoint );
79
81 GAL_API unsigned int GlyphCount();
82
84
86 GAL_API double SpaceAdvance();
87
89 GAL_API std::pair<VECTOR2D, float> ComputeBitmapTextSize( const UTF8& aText );
90
91 }
92
93}
94
95#endif
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition utf8.h:67
#define GAL_API
Definition gal.h:27
unsigned int GlyphCount()
The number of glyphs in the font, starting at LookupGlyph( '!
std::pair< VECTOR2D, float > ComputeBitmapTextSize(const UTF8 &aText)
Size of a line of text in atlas units, and how far its glyphs sit above their lowest point.
double SpaceAdvance()
How far a space moves the pen.
const FONT_GLYPH_TYPE * LookupGlyph(unsigned int aCodepoint)
FONT_INFO_TYPE font_information
GAL_API FONT_IMAGE_TYPE font_image
GLYPH_BOX ComputeGlyphBox(const FONT_GLYPH_TYPE &aGlyph)
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
unsigned char pixels[1024 *1107 *3]
Where a glyph's quad sits and what it samples, in font units, which are also atlas texels.
float h
size of the quad and of its cell in the atlas
float atlasY
corner of the cell in the atlas, inside its smoothing border
float y
corner of the quad from the pen position