font: cache_size -> glyph_cache_size

This makes it more clear it has nothing to do with the font cache.
This commit is contained in:
Daniel Eklöf 2019-11-30 12:41:09 +01:00
parent 7a4d1b1a6e
commit 10f563dc6b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

8
font.c
View file

@ -20,7 +20,7 @@
static FT_Library ft_lib;
static mtx_t ft_lock;
static const size_t cache_size = 512;
static const size_t glyph_cache_size = 512;
struct font_cache_entry {
uint64_t hash;
@ -288,7 +288,7 @@ from_font_set(FcPattern *pattern, FcFontSet *fonts, int start_idx,
font->fc_fonts = !is_fallback ? fonts : NULL;
font->fc_loaded_fallbacks = calloc(
fonts->nfont, sizeof(font->fc_loaded_fallbacks[0]));
font->glyph_cache = calloc(cache_size, sizeof(font->glyph_cache[0]));
font->glyph_cache = calloc(glyph_cache_size, sizeof(font->glyph_cache[0]));
}
double max_x_advance = ft_face->size->metrics.max_advance / 64.;
@ -433,7 +433,7 @@ font_from_name(font_list_t names, const char *attributes)
static size_t
hash_index(wchar_t wc)
{
return wc % cache_size;
return wc % glyph_cache_size;
}
static bool
@ -768,7 +768,7 @@ font_destroy(struct font *font)
FcFontSetDestroy(font->fc_fonts);
for (size_t i = 0; i < cache_size && font->glyph_cache != NULL; i++) {
for (size_t i = 0; i < glyph_cache_size && font->glyph_cache != NULL; i++) {
if (font->glyph_cache[i] == NULL)
continue;