Cleanup: use const FontBLF arguments

This commit is contained in:
Campbell Barton 2022-08-28 20:46:53 +10:00
parent 206272621e
commit 7269ee4dbb
4 changed files with 10 additions and 8 deletions

View File

@ -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();

View File

@ -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);
}

View File

@ -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) {

View File

@ -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);