24 #define FABGL_FONT_INCLUDE_DEFINITION 36 static const FontInfo * FIXED_WIDTH_EMBEDDED_FONTS[] = {
49 static const FontInfo * VAR_WIDTH_EMBEDDED_FONTS[] = {
63 FontInfo
const * getFixedWidthFont(
int index)
65 return FIXED_WIDTH_EMBEDDED_FONTS[index];
69 int getFixedWidthFontCount()
71 return sizeof(FIXED_WIDTH_EMBEDDED_FONTS) /
sizeof(FontInfo*);
75 FontInfo
const * getVarWidthFont(
int index)
77 return VAR_WIDTH_EMBEDDED_FONTS[index];
81 int getVarWidthFontCount()
83 return sizeof(VAR_WIDTH_EMBEDDED_FONTS) /
sizeof(FontInfo*);
87 FontInfo
const * getPresetFontInfo(
int viewPortWidth,
int viewPortHeight,
int columns,
int rows)
89 FontInfo
const * fontInfo =
nullptr;
90 for (
int i = 0; i < getFixedWidthFontCount(); ++i) {
91 fontInfo = getFixedWidthFont(i);
92 if (viewPortWidth / fontInfo->width >= columns && viewPortHeight / fontInfo->height >= rows)
100 FontInfo
const * getPresetFontInfoFromHeight(
int height,
bool fixedWidth)
102 FontInfo
const * fontInfo =
nullptr;
104 for (
int i = 0; i < getFixedWidthFontCount(); ++i) {
105 fontInfo = getFixedWidthFont(i);
106 if (
height >= fontInfo->height)
110 for (
int i = 0; i < getVarWidthFontCount(); ++i) {
111 fontInfo = getVarWidthFont(i);
112 if (
height >= fontInfo->height)
121 FontInfo
const * getPresetFixedFont(
int width,
int height)
123 FontInfo
const * fontInfo =
nullptr;
124 for (
int i = 0; i < getFixedWidthFontCount(); ++i) {
125 fontInfo = getFixedWidthFont(i);
126 if (
height == fontInfo->height &&
width == fontInfo->width)