Lines Matching refs:font

61 int gr_measure(const GRFont* font, const char* s) {  in gr_measure()  argument
62 if (font == nullptr) { in gr_measure()
66 return font->char_width * strlen(s); in gr_measure()
69 int gr_font_size(const GRFont* font, int* x, int* y) { in gr_font_size() argument
70 if (font == nullptr) { in gr_font_size()
74 *x = font->char_width; in gr_font_size()
75 *y = font->char_height; in gr_font_size()
158 void gr_text(const GRFont* font, int x, int y, const char* s, bool bold) { in gr_text() argument
159 if (!font || !font->texture || (gr_current & alpha_mask) == 0) return; in gr_text()
161 if (font->texture->pixel_bytes != 1) { in gr_text()
166 bold = bold && (font->texture->height != font->char_height); in gr_text()
173 if (outside(x, y) || outside(x + font->char_width - 1, y + font->char_height - 1)) break; in gr_text()
180 const uint8_t* src_p = font->texture->data() + ((ch - ' ') * font->char_width) + in gr_text()
181 (bold ? font->char_height * font->texture->row_bytes : 0); in gr_text()
184 TextBlend(src_p, font->texture->row_bytes, dst_p, row_pixels, font->char_width, in gr_text()
185 font->char_height); in gr_text()
187 x += font->char_width; in gr_text()
318 GRFont* font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font))); in gr_init_font() local
319 if (font == nullptr) { in gr_init_font()
323 int res = res_create_alpha_surface(name, &(font->texture)); in gr_init_font()
325 free(font); in gr_init_font()
332 font->char_width = font->texture->width / 96; in gr_init_font()
333 font->char_height = font->texture->height / 2; in gr_init_font()
335 *dest = font; in gr_init_font()