Lines Matching refs:font
60 int gr_measure(const GRFont* font, const char* s) { in gr_measure() argument
61 if (font == nullptr) { in gr_measure()
65 return font->char_width * strlen(s); in gr_measure()
68 int gr_font_size(const GRFont* font, int* x, int* y) { in gr_font_size() argument
69 if (font == nullptr) { in gr_font_size()
73 *x = font->char_width; in gr_font_size()
74 *y = font->char_height; in gr_font_size()
157 void gr_text(const GRFont* font, int x, int y, const char* s, bool bold) { in gr_text() argument
158 if (!font || !font->texture || (gr_current & alpha_mask) == 0) return; in gr_text()
160 if (font->texture->pixel_bytes != 1) { in gr_text()
165 bold = bold && (font->texture->height != font->char_height); in gr_text()
172 if (outside(x, y) || outside(x + font->char_width - 1, y + font->char_height - 1)) break; in gr_text()
179 const uint8_t* src_p = font->texture->data() + ((ch - ' ') * font->char_width) + in gr_text()
180 (bold ? font->char_height * font->texture->row_bytes : 0); in gr_text()
183 TextBlend(src_p, font->texture->row_bytes, dst_p, row_pixels, font->char_width, in gr_text()
184 font->char_height); in gr_text()
186 x += font->char_width; in gr_text()
317 GRFont* font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font))); in gr_init_font() local
318 if (font == nullptr) { in gr_init_font()
322 int res = res_create_alpha_surface(name, &(font->texture)); in gr_init_font()
324 free(font); in gr_init_font()
331 font->char_width = font->texture->width / 96; in gr_init_font()
332 font->char_height = font->texture->height / 2; in gr_init_font()
334 *dest = font; in gr_init_font()