MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / modFindPebbleFont

Function modFindPebbleFont

xs/platforms/pebble/xsHost.c:616–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614};
615
616GFont modFindPebbleFont(const char *family, int size, int32_t *ascent, int32_t *descent, int32_t *leading)
617{
618 PebbleFont f = (PebbleFont)gFonts;
619
620 for (; C_NULL != f->family; f++) {
621 if ((size == f->size) && !c_strcmp(family, f->family))
622 break;
623 }
624
625 GFont font = C_NULL;
626 if (f->family) {
627 font = fonts_get_system_font(f->res_key);
628 }
629 if (!font) {
630// font = fonts_get_system_font(FONT_KEY_FONT_FALLBACK);
631// if (!font)
632 return C_NULL;
633 }
634
635 uint16_t height = fonts_get_font_height(font);
636 *descent = fonts_get_font_cap_offset(font);
637 *leading = 1;
638 *ascent = height - *descent - *leading;
639 return font;
640}
641
642
643

Callers 2

PiuStyleLookupFontFunction · 0.85
PiuStyleLookupFontFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected