KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gl_resources.cpp
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, you may find one here:
18
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19
* or you may search the http://www.gnu.org website for the version 2 license,
20
* or you may write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
*/
23
24
// The current font is "Ubuntu Mono" available under Ubuntu Font Licence 1.0
25
// (see ubuntu-font-licence-1.0.txt for details)
26
#include <algorithm>
27
#include "
gl_resources.h
"
28
29
#define BITMAP_FONT_USE_SPANS
30
31
namespace
KIGFX
{
32
namespace
BUILTIN_FONT
{
33
34
#include "bitmap_font_img.c"
35
#include "bitmap_font_desc.c"
36
37
const
FONT_GLYPH_TYPE
*
LookupGlyph
(
unsigned
int
aCodepoint )
38
{
39
#ifdef BITMAP_FONT_USE_SPANS
40
auto
*
end
=
font_codepoint_spans
+
sizeof
(
font_codepoint_spans
) /
sizeof
(
FONT_SPAN_TYPE
);
41
42
auto
ptr = std::upper_bound(
font_codepoint_spans
,
end
, aCodepoint,
43
[](
unsigned
int
codepoint,
const
FONT_SPAN_TYPE
& span )
44
{
45
return
codepoint < span.
end
;
46
} );
47
48
if
( ptr !=
end
&& ptr->start <= aCodepoint )
49
{
50
unsigned
int
index = aCodepoint - ptr->start + ptr->cumulative;
51
return
&
font_codepoint_infos
[ index ];
52
}
53
else
54
{
55
return
nullptr
;
56
}
57
#else
58
return
&bitmap_chars[codepoint];
59
#endif
60
}
61
62
}
63
}
gl_resources.h
KIGFX::BUILTIN_FONT
Definition
gl_resources.cpp:32
KIGFX::BUILTIN_FONT::LookupGlyph
const FONT_GLYPH_TYPE * LookupGlyph(unsigned int aCodepoint)
Definition
gl_resources.cpp:37
KIGFX::BUILTIN_FONT::font_codepoint_spans
FONT_SPAN_TYPE font_codepoint_spans[]
Definition
gl_resources.cpp:9
KIGFX::BUILTIN_FONT::font_codepoint_infos
FONT_GLYPH_TYPE font_codepoint_infos[]
Definition
gl_resources.cpp:101
KIGFX
The Cairo implementation of the graphics abstraction layer.
Definition
eda_group.h:33
KIGFX::BUILTIN_FONT::FONT_GLYPH_TYPE
Definition
gl_resources.h:56
KIGFX::BUILTIN_FONT::FONT_SPAN_TYPE
Definition
gl_resources.h:49
KIGFX::BUILTIN_FONT::FONT_SPAN_TYPE::end
unsigned int end
Definition
gl_resources.h:51
end
VECTOR2I end
Definition
test_shape_arc.cpp:624
src
common
gal
opengl
gl_resources.cpp
Generated on Sun Sep 21 2025 01:05:20 for KiCad PCB EDA Suite by
1.13.2