Formatting.

This commit is contained in:
Jeff Young 2022-01-11 14:34:16 +00:00
parent 8f7d2dd06a
commit 33338aa0f2
1 changed files with 22 additions and 23 deletions

View File

@ -29,36 +29,35 @@
#define BITMAP_FONT_USE_SPANS
namespace KIGFX {
namespace BUILTIN_FONT {
namespace BUILTIN_FONT {
#include "bitmap_font_img.c"
#include "bitmap_font_desc.c"
const FONT_GLYPH_TYPE* LookupGlyph( unsigned int aCodepoint )
{
const FONT_GLYPH_TYPE* LookupGlyph( unsigned int aCodepoint )
{
#ifdef BITMAP_FONT_USE_SPANS
auto *end = font_codepoint_spans
+ sizeof( font_codepoint_spans ) / sizeof(FONT_SPAN_TYPE);
auto ptr = std::upper_bound( font_codepoint_spans, end, aCodepoint,
[]( unsigned int codepoint, const FONT_SPAN_TYPE& span )
{
return codepoint < span.end;
}
);
auto *end = font_codepoint_spans + sizeof( font_codepoint_spans ) / sizeof(FONT_SPAN_TYPE);
if( ptr != end && ptr->start <= aCodepoint )
auto ptr = std::upper_bound( font_codepoint_spans, end, aCodepoint,
[]( unsigned int codepoint, const FONT_SPAN_TYPE& span )
{
unsigned int index = aCodepoint - ptr->start + ptr->cumulative;
return &font_codepoint_infos[ index ];
}
else
{
return nullptr;
}
#else
return &bitmap_chars[codepoint];
#endif
}
return codepoint < span.end;
} );
if( ptr != end && ptr->start <= aCodepoint )
{
unsigned int index = aCodepoint - ptr->start + ptr->cumulative;
return &font_codepoint_infos[ index ];
}
else
{
return nullptr;
}
#else
return &bitmap_chars[codepoint];
#endif
}
}
}