28#define FABGL_FONT_INCLUDE_DEFINITION
40static const FontInfo * FIXED_WIDTH_EMBEDDED_FONTS[] = {
53static const FontInfo * VAR_WIDTH_EMBEDDED_FONTS[] = {
67FontInfo
const * getFixedWidthFont(
int index)
69 return FIXED_WIDTH_EMBEDDED_FONTS[index];
73int getFixedWidthFontCount()
75 return sizeof(FIXED_WIDTH_EMBEDDED_FONTS) /
sizeof(FontInfo*);
79FontInfo
const * getVarWidthFont(
int index)
81 return VAR_WIDTH_EMBEDDED_FONTS[index];
85int getVarWidthFontCount()
87 return sizeof(VAR_WIDTH_EMBEDDED_FONTS) /
sizeof(FontInfo*);
91FontInfo
const * getPresetFontInfo(
int viewPortWidth,
int viewPortHeight,
int columns,
int rows)
93 FontInfo
const * fontInfo =
nullptr;
94 for (
int i = 0; i < getFixedWidthFontCount(); ++i) {
95 fontInfo = getFixedWidthFont(i);
96 if (viewPortWidth / fontInfo->width >= columns && viewPortHeight / fontInfo->height >= rows)
104FontInfo
const * getPresetFontInfoFromHeight(
int height,
bool fixedWidth)
106 FontInfo
const * fontInfo =
nullptr;
108 for (
int i = 0; i < getFixedWidthFontCount(); ++i) {
109 fontInfo = getFixedWidthFont(i);
110 if (
height >= fontInfo->height)
114 for (
int i = 0; i < getVarWidthFontCount(); ++i) {
115 fontInfo = getVarWidthFont(i);
116 if (
height >= fontInfo->height)
125FontInfo
const * getPresetFixedFont(
int width,
int height)
127 FontInfo
const * fontInfo =
nullptr;
128 for (
int i = 0; i < getFixedWidthFontCount(); ++i) {
129 fontInfo = getFixedWidthFont(i);
130 if (
height == fontInfo->height &&
width == fontInfo->width)