Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenfont/intern/blf_font_i18n.c
| Show All 40 Lines | |||||
| #include "BKE_appdir.h" | #include "BKE_appdir.h" | ||||
| #ifdef WITH_INTERNATIONAL | #ifdef WITH_INTERNATIONAL | ||||
| #include "BLI_fileops.h" | #include "BLI_fileops.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "CLG_log.h" | |||||
| static CLG_LogRef LOG = {"blf.i18n"}; | |||||
| struct FontBuf { | struct FontBuf { | ||||
| const char *filename; | const char *filename; | ||||
| uchar *data; | uchar *data; | ||||
| int data_len; | 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 struct FontBuf unifont_mono_ttf = {"bmonofont-i18n.ttf.gz"}; | ||||
| static void fontbuf_load(struct FontBuf *fb) | static void fontbuf_load(struct FontBuf *fb) | ||||
| { | { | ||||
| const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts"); | const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts"); | ||||
| if (fontpath) { | if (fontpath) { | ||||
| char unifont_path[1024]; | char unifont_path[1024]; | ||||
| BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, fb->filename); | 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); | fb->data = (uchar *)BLI_file_ungzip_to_mem(unifont_path, &fb->data_len); | ||||
| } | } | ||||
| else { | else { | ||||
| printf("%s: 'fonts' data path not found for '%s', continuing\n", __func__, fb->filename); | CLOG_WARN(&LOG, "'fonts' data path not found for '%s', continuing", fb->filename); | ||||
| } | } | ||||
| } | } | ||||
| static void fontbuf_free(struct FontBuf *fb) | static void fontbuf_free(struct FontBuf *fb) | ||||
| { | { | ||||
| MEM_SAFE_FREE(fb->data); | MEM_SAFE_FREE(fb->data); | ||||
| fb->data_len = 0; | fb->data_len = 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines | |||||