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, see <https://www.gnu.org/licenses/>.
18
*/
19
20
// The current font is "Ubuntu Mono" available under Ubuntu Font Licence 1.0
21
// (see ubuntu-font-licence-1.0.txt for details)
22
#include <algorithm>
23
#include "
gl_resources.h
"
24
25
#define BITMAP_FONT_USE_SPANS
26
27
namespace
KIGFX
{
28
namespace
BUILTIN_FONT
{
29
30
#include "bitmap_font_img.c"
31
#include "bitmap_font_desc.c"
32
33
const
FONT_GLYPH_TYPE
*
LookupGlyph
(
unsigned
int
aCodepoint )
34
{
35
#ifdef BITMAP_FONT_USE_SPANS
36
auto
*
end
=
font_codepoint_spans
+
sizeof
(
font_codepoint_spans
) /
sizeof
(
FONT_SPAN_TYPE
);
37
38
auto
ptr = std::upper_bound(
font_codepoint_spans
,
end
, aCodepoint,
39
[](
unsigned
int
codepoint,
const
FONT_SPAN_TYPE
& span )
40
{
41
return
codepoint < span.
end
;
42
} );
43
44
if
( ptr !=
end
&& ptr->start <= aCodepoint )
45
{
46
unsigned
int
index
= aCodepoint - ptr->start + ptr->cumulative;
47
return
&
font_codepoint_infos
[
index
];
48
}
49
else
50
{
51
return
nullptr
;
52
}
53
#else
54
return
&bitmap_chars[codepoint];
55
#endif
56
}
57
58
}
59
}
index
int index
Definition
DXF_plotter.cpp:62
gl_resources.h
KIGFX::BUILTIN_FONT
Definition
gl_resources.cpp:28
KIGFX::BUILTIN_FONT::LookupGlyph
const FONT_GLYPH_TYPE * LookupGlyph(unsigned int aCodepoint)
Definition
gl_resources.cpp:33
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:29
KIGFX::BUILTIN_FONT::FONT_GLYPH_TYPE
Definition
gl_resources.h:52
KIGFX::BUILTIN_FONT::FONT_SPAN_TYPE
Definition
gl_resources.h:45
KIGFX::BUILTIN_FONT::FONT_SPAN_TYPE::end
unsigned int end
Definition
gl_resources.h:47
end
VECTOR2I end
Definition
test_shape_arc.cpp:622
src
common
gal
opengl
gl_resources.cpp
Generated on Fri Jun 26 2026 00:05:32 for KiCad PCB EDA Suite by
1.13.2