Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenfont/intern/blf_font.c
| Show First 20 Lines • Show All 1,140 Lines • ▼ Show 20 Lines | void blf_font_draw_buffer__wrap(FontBLF *font, | ||||
| struct ResultBLF *r_info) | struct ResultBLF *r_info) | ||||
| { | { | ||||
| blf_font_wrap_apply(font, str, str_len, r_info, blf_font_draw_buffer__wrap_cb, NULL); | blf_font_wrap_apply(font, str, str_len, r_info, blf_font_draw_buffer__wrap_cb, NULL); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Text Evaluation: Count Missing Characters | |||||
| * \{ */ | |||||
| int blf_font_count_missing_chars(FontBLF *font, | |||||
| const char *str, | |||||
| const size_t str_len, | |||||
| int *r_tot_chars) | |||||
| { | |||||
| int missing = 0; | |||||
| size_t i = 0; | |||||
| *r_tot_chars = 0; | |||||
| while (i < str_len) { | |||||
| uint c; | |||||
| if ((c = str[i]) < GLYPH_ASCII_TABLE_SIZE) { | |||||
| i++; | |||||
| } | |||||
| else { | |||||
| c = BLI_str_utf8_as_unicode_step(str, str_len, &i); | |||||
| if (blf_get_char_index(font, c) == 0) { | |||||
| missing++; | |||||
| } | |||||
| } | |||||
| (*r_tot_chars)++; | |||||
| } | |||||
| return missing; | |||||
| } | |||||
| /** \} */ | |||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Font Query: Attributes | /** \name Font Query: Attributes | ||||
| * \{ */ | * \{ */ | ||||
| static ft_pix blf_font_height_max_ft_pix(FontBLF *font) | static ft_pix blf_font_height_max_ft_pix(FontBLF *font) | ||||
| { | { | ||||
| blf_ensure_size(font); | blf_ensure_size(font); | ||||
| /* Metrics.height is rounded to pixel. Force minimum of one pixel. */ | /* Metrics.height is rounded to pixel. Force minimum of one pixel. */ | ||||
| return MAX2((ft_pix)font->ft_size->metrics.height, ft_pix_from_int(1)); | return MAX2((ft_pix)font->ft_size->metrics.height, ft_pix_from_int(1)); | ||||
| ▲ Show 20 Lines • Show All 476 Lines • Show Last 20 Lines | |||||