Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf.c64
-rw-r--r--source/blender/blenfont/intern/blf_dir.c7
-rw-r--r--source/blender/blenfont/intern/blf_font.c3
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c4
-rw-r--r--source/blender/blenfont/intern/blf_thumbs.c3
5 files changed, 23 insertions, 58 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index c5c2bc3f3ba..547112ecf66 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -92,9 +92,7 @@ static FontBLF *blf_get(int fontid)
int BLF_init(void)
{
- int i;
-
- for (i = 0; i < BLF_MAX_FONT; i++) {
+ for (int i = 0; i < BLF_MAX_FONT; i++) {
global_font[i] = NULL;
}
@@ -111,11 +109,8 @@ void BLF_default_dpi(int dpi)
void BLF_exit(void)
{
- FontBLF *font;
- int i;
-
- for (i = 0; i < BLF_MAX_FONT; i++) {
- font = global_font[i];
+ for (int i = 0; i < BLF_MAX_FONT; i++) {
+ FontBLF *font = global_font[i];
if (font) {
blf_font_free(font);
global_font[i] = NULL;
@@ -127,11 +122,8 @@ void BLF_exit(void)
void BLF_cache_clear(void)
{
- FontBLF *font;
- int i;
-
- for (i = 0; i < BLF_MAX_FONT; i++) {
- font = global_font[i];
+ for (int i = 0; i < BLF_MAX_FONT; i++) {
+ FontBLF *font = global_font[i];
if (font) {
blf_glyph_cache_clear(font);
blf_kerning_cache_clear(font);
@@ -141,11 +133,8 @@ void BLF_cache_clear(void)
static int blf_search(const char *name)
{
- FontBLF *font;
- int i;
-
- for (i = 0; i < BLF_MAX_FONT; i++) {
- font = global_font[i];
+ for (int i = 0; i < BLF_MAX_FONT; i++) {
+ FontBLF *font = global_font[i];
if (font && (STREQ(font->name, name))) {
return i;
}
@@ -156,9 +145,7 @@ static int blf_search(const char *name)
static int blf_search_available(void)
{
- int i;
-
- for (i = 0; i < BLF_MAX_FONT; i++) {
+ for (int i = 0; i < BLF_MAX_FONT; i++) {
if (!global_font[i]) {
return i;
}
@@ -192,13 +179,10 @@ bool BLF_has_glyph(int fontid, unsigned int unicode)
int BLF_load(const char *name)
{
- FontBLF *font;
- int i;
-
/* check if we already load this font. */
- i = blf_search(name);
+ int i = blf_search(name);
if (i >= 0) {
- font = global_font[i];
+ FontBLF *font = global_font[i];
font->reference_count++;
return i;
}
@@ -208,26 +192,22 @@ int BLF_load(const char *name)
int BLF_load_unique(const char *name)
{
- FontBLF *font;
- char *filename;
- int i;
-
/* Don't search in the cache!! make a new
* object font, this is for keep fonts threads safe.
*/
- i = blf_search_available();
+ int i = blf_search_available();
if (i == -1) {
printf("Too many fonts!!!\n");
return -1;
}
- filename = blf_dir_search(name);
+ char *filename = blf_dir_search(name);
if (!filename) {
printf("Can't find font: %s\n", name);
return -1;
}
- font = blf_font_new(name, filename);
+ FontBLF *font = blf_font_new(name, filename);
MEM_freeN(filename);
if (!font) {
@@ -251,9 +231,7 @@ void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size)
int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size)
{
- int i;
-
- i = blf_search(name);
+ int i = blf_search(name);
if (i >= 0) {
/*font = global_font[i];*/ /*UNUSED*/
return i;
@@ -263,14 +241,11 @@ int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size)
int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size)
{
- FontBLF *font;
- int i;
-
/*
* Don't search in the cache, make a new object font!
* this is to keep the font thread safe.
*/
- i = blf_search_available();
+ int i = blf_search_available();
if (i == -1) {
printf("Too many fonts!!!\n");
return -1;
@@ -281,7 +256,7 @@ int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size
return -1;
}
- font = blf_font_new_from_mem(name, mem, mem_size);
+ FontBLF *font = blf_font_new_from_mem(name, mem, mem_size);
if (!font) {
printf("Can't load font: %s from memory!!\n", name);
return -1;
@@ -294,11 +269,8 @@ int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size
void BLF_unload(const char *name)
{
- FontBLF *font;
- int i;
-
- for (i = 0; i < BLF_MAX_FONT; i++) {
- font = global_font[i];
+ for (int i = 0; i < BLF_MAX_FONT; i++) {
+ FontBLF *font = global_font[i];
if (font && (STREQ(font->name, name))) {
BLI_assert(font->reference_count > 0);
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index 9603470615d..51d3849aa48 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -115,11 +115,8 @@ char **BLF_dir_get(int *ndir)
void BLF_dir_free(char **dirs, int count)
{
- char *path;
- int i;
-
- for (i = 0; i < count; i++) {
- path = dirs[i];
+ for (int i = 0; i < count; i++) {
+ char *path = dirs[i];
MEM_freeN(path);
}
MEM_freeN(dirs);
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 1b27b6dd4c1..1501ee07b66 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -316,8 +316,7 @@ static GlyphBLF **blf_font_ensure_ascii_table(FontBLF *font, GlyphCacheBLF *gc)
/* build ascii on demand */
if (glyph_ascii_table['0'] == NULL) {
GlyphBLF *g;
- unsigned int i;
- for (i = 0; i < 256; i++) {
+ for (uint i = 0; i < 256; i++) {
g = blf_glyph_search(gc, i);
if (!g) {
FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 8e74d5bba7c..f3c5c057dec 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -205,9 +205,7 @@ void blf_glyph_cache_clear(FontBLF *font)
void blf_glyph_cache_free(GlyphCacheBLF *gc)
{
GlyphBLF *g;
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(gc->bucket); i++) {
+ for (uint i = 0; i < ARRAY_SIZE(gc->bucket); i++) {
while ((g = BLI_pophead(&gc->bucket[i]))) {
blf_glyph_free(g);
}
diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index 6aa39e3aa71..3153a55b697 100644
--- a/source/blender/blenfont/intern/blf_thumbs.c
+++ b/source/blender/blenfont/intern/blf_thumbs.c
@@ -67,7 +67,6 @@ void BLF_thumb_preview(const char *filename,
FontBLF *font;
GlyphCacheBLF *gc;
- int i;
/* Create a new blender font obj and fill it with default values */
font = blf_font_new("thumb_font", filename);
@@ -91,7 +90,7 @@ void BLF_thumb_preview(const char *filename,
blf_draw_buffer__start(font);
- for (i = 0; i < draw_str_lines; i++) {
+ for (int i = 0; i < draw_str_lines; i++) {
const char *draw_str_i18n = i18n_draw_str[i] != NULL ? i18n_draw_str[i] : draw_str[i];
const size_t draw_str_i18n_len = strlen(draw_str_i18n);
int draw_str_i18n_nbr = 0;