KiCad PCB EDA Suite
KIGFX::BUILTIN_FONT Namespace Reference

Classes

struct  FONT_GLYPH_TYPE
 
struct  FONT_IMAGE_TYPE
 
struct  FONT_INFO_TYPE
 
struct  FONT_SPAN_TYPE
 

Functions

const FONT_GLYPH_TYPELookupGlyph (unsigned int aCodepoint)
 

Variables

FONT_IMAGE_TYPE font_image
 
FONT_INFO_TYPE font_information
 
FONT_SPAN_TYPE font_codepoint_spans []
 
FONT_GLYPH_TYPE font_codepoint_infos []
 
static const int bitmap_chars_count = 65535
 

Function Documentation

const FONT_GLYPH_TYPE * KIGFX::BUILTIN_FONT::LookupGlyph ( unsigned int  aCodepoint)

Definition at line 37 of file gl_resources.cpp.

References KIGFX::BUILTIN_FONT::FONT_SPAN_TYPE::end, font_codepoint_infos, and font_codepoint_spans.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), KIGFX::OPENGL_GAL::computeBitmapTextSize(), KIGFX::OPENGL_GAL::drawBitmapChar(), and KIGFX::OPENGL_GAL::drawBitmapOverbar().

38  {
39 #ifdef BITMAP_FONT_USE_SPANS
40  auto *end = font_codepoint_spans
41  + sizeof( font_codepoint_spans ) / sizeof(FONT_SPAN_TYPE);
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 
49  if( ptr != end && ptr->start <= aCodepoint )
50  {
51  unsigned int index = aCodepoint - ptr->start + ptr->cumulative;
52  return &font_codepoint_infos[ index ];
53  }
54  else
55  {
56  return nullptr;
57  }
58 #else
59  return &bitmap_chars[codepoint];
60 #endif
61  }
FONT_SPAN_TYPE font_codepoint_spans[]
Definition: gl_resources.cpp:9
FONT_GLYPH_TYPE font_codepoint_infos[]

Variable Documentation

const int KIGFX::BUILTIN_FONT::bitmap_chars_count = 65535
static

Definition at line 1320 of file gl_resources.cpp.

FONT_GLYPH_TYPE KIGFX::BUILTIN_FONT::font_codepoint_infos[]

Definition at line 101 of file gl_resources.cpp.

Referenced by LookupGlyph().

FONT_SPAN_TYPE KIGFX::BUILTIN_FONT::font_codepoint_spans[]

Definition at line 9 of file gl_resources.cpp.

Referenced by LookupGlyph().

FONT_IMAGE_TYPE KIGFX::BUILTIN_FONT::font_image
FONT_INFO_TYPE KIGFX::BUILTIN_FONT::font_information
Initial value:
= {
1,
-8.16f,
39.84f
}

Definition at line 3 of file gl_resources.cpp.

Referenced by KIGFX::OPENGL_GAL::computeBitmapTextSize(), and KIGFX::OPENGL_GAL::drawBitmapChar().