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/intern/blf_font_i18n.c')
-rw-r--r--source/blender/blenfont/intern/blf_font_i18n.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/source/blender/blenfont/intern/blf_font_i18n.c b/source/blender/blenfont/intern/blf_font_i18n.c
index 2a69d714dc6..74113ae4ce1 100644
--- a/source/blender/blenfont/intern/blf_font_i18n.c
+++ b/source/blender/blenfont/intern/blf_font_i18n.c
@@ -36,80 +36,78 @@
#ifdef WITH_INTERNATIONAL
-#include "BLI_fileops.h"
-#include "BLI_string.h"
+# include "BLI_fileops.h"
+# include "BLI_string.h"
struct FontBuf {
- const char *filename;
- uchar *data;
- int data_len;
+ const char *filename;
+ uchar *data;
+ int data_len;
};
-static struct FontBuf unifont_ttf = {"droidsans.ttf.gz"};
+static struct FontBuf unifont_ttf = {"droidsans.ttf.gz"};
static struct FontBuf unifont_mono_ttf = {"bmonofont-i18n.ttf.gz"};
static void fontbuf_load(struct FontBuf *fb)
{
- const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
- if (fontpath) {
- char unifont_path[1024];
- BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, fb->filename);
- fb->data = (uchar *)BLI_file_ungzip_to_mem(unifont_path, &fb->data_len);
-
- }
- else {
- printf("%s: 'fonts' data path not found for '%s', continuing\n", __func__, fb->filename);
- }
+ const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
+ if (fontpath) {
+ char unifont_path[1024];
+ BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, fb->filename);
+ fb->data = (uchar *)BLI_file_ungzip_to_mem(unifont_path, &fb->data_len);
+ }
+ else {
+ printf("%s: 'fonts' data path not found for '%s', continuing\n", __func__, fb->filename);
+ }
}
static void fontbuf_free(struct FontBuf *fb)
{
- MEM_SAFE_FREE(fb->data);
- fb->data_len = 0;
+ MEM_SAFE_FREE(fb->data);
+ fb->data_len = 0;
}
static uchar *fontbuf_get_mem(struct FontBuf *fb, int *r_size)
{
- if (fb->data == NULL) {
- fontbuf_load(fb);
- }
- *r_size = fb->data_len;
- return fb->data;
+ if (fb->data == NULL) {
+ fontbuf_load(fb);
+ }
+ *r_size = fb->data_len;
+ return fb->data;
}
#endif /* WITH_INTERNATIONAL */
-
uchar *BLF_get_unifont(int *r_unifont_size)
{
#ifdef WITH_INTERNATIONAL
- return fontbuf_get_mem(&unifont_ttf, r_unifont_size);
+ return fontbuf_get_mem(&unifont_ttf, r_unifont_size);
#else
- UNUSED_VARS(r_unifont_size);
- return NULL;
+ UNUSED_VARS(r_unifont_size);
+ return NULL;
#endif
}
uchar *BLF_get_unifont_mono(int *r_unifont_size)
{
#ifdef WITH_INTERNATIONAL
- return fontbuf_get_mem(&unifont_mono_ttf, r_unifont_size);
+ return fontbuf_get_mem(&unifont_mono_ttf, r_unifont_size);
#else
- UNUSED_VARS(r_unifont_size);
- return NULL;
+ UNUSED_VARS(r_unifont_size);
+ return NULL;
#endif
}
void BLF_free_unifont(void)
{
#ifdef WITH_INTERNATIONAL
- fontbuf_free(&unifont_ttf);
+ fontbuf_free(&unifont_ttf);
#endif
}
void BLF_free_unifont_mono(void)
{
#ifdef WITH_INTERNATIONAL
- fontbuf_free(&unifont_mono_ttf);
+ fontbuf_free(&unifont_mono_ttf);
#endif
}