From 7269ee4dbbc2d46eee864029772aa0e167cd267a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2022 20:46:53 +1000 Subject: Cleanup: use const FontBLF arguments --- source/blender/blenfont/intern/blf.c | 6 +++--- source/blender/blenfont/intern/blf_font.c | 7 +++---- source/blender/blenfont/intern/blf_glyph.c | 2 +- source/blender/blenfont/intern/blf_internal.h | 3 +++ 4 files changed, 10 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 6fcb74e9cb0..9d9cc51ebcc 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -99,7 +99,7 @@ bool blf_font_id_is_valid(int fontid) static int blf_search(const char *name) { for (int i = 0; i < BLF_MAX_FONT; i++) { - FontBLF *font = global_font[i]; + const FontBLF *font = global_font[i]; if (font && (STREQ(font->name, name))) { return i; } @@ -484,7 +484,7 @@ void BLF_batch_draw_end(void) g_batch.enabled = false; } -static void blf_draw_gl__start(FontBLF *font) +static void blf_draw_gl__start(const FontBLF *font) { /* * The pixmap alignment hack is handle @@ -512,7 +512,7 @@ static void blf_draw_gl__start(FontBLF *font) } } -static void blf_draw_gl__end(FontBLF *font) +static void blf_draw_gl__end(const FontBLF *font) { if ((font->flags & (BLF_ROTATION | BLF_MATRIX | BLF_ASPECT)) != 0) { GPU_matrix_pop(); diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 8941eb01d3a..886c34654c4 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -128,11 +128,10 @@ static void blf_size_finalizer(void *object) /** \name FreeType Utilities (Internal) * \{ */ -/* Return glyph id from charcode. */ -uint blf_get_char_index(struct FontBLF *font, uint charcode) +uint blf_get_char_index(FontBLF *font, uint charcode) { if (font->flags & BLF_CACHED) { - /* Use charmap cache for much faster lookup. */ + /* Use char-map cache for much faster lookup. */ return FTC_CMapCache_Lookup(ftc_charmap_cache, font, -1, charcode); } /* Fonts that are not cached need to use the regular lookup function. */ @@ -149,7 +148,7 @@ static ft_pix blf_unscaled_F26Dot6_to_pixels(FontBLF *font, FT_Pos value) FT_Long scaled = FT_MulFix(value, font->ft_size->metrics.x_scale); /* Copied from FreeType's FT_Get_Kerning (with FT_KERNING_DEFAULT), scaling down */ - /* kerning distances at small ppem values so that they don't become too big. */ + /* kerning distances at small PPEM values so that they don't become too big. */ if (font->ft_size->metrics.x_ppem < 25) { scaled = FT_MulDiv(scaled, font->ft_size->metrics.x_ppem, 25); } diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 18f372c666b..c08d52307b7 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -63,7 +63,7 @@ static FT_Fixed to_16dot16(double val) /** \name Glyph Cache * \{ */ -static GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, const float size, uint dpi) +static GlyphCacheBLF *blf_glyph_cache_find(const FontBLF *font, const float size, uint dpi) { GlyphCacheBLF *gc = (GlyphCacheBLF *)font->cache.first; while (gc) { diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 5c1099d6386..39d3af22562 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -46,6 +46,9 @@ void blf_font_exit(void); bool blf_font_id_is_valid(int fontid); +/** + * Return glyph id from char-code. + */ uint blf_get_char_index(struct FontBLF *font, uint charcode); bool blf_ensure_face(struct FontBLF *font); -- cgit v1.2.3