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.c')
-rw-r--r--source/blender/blenfont/intern/blf.c70
1 files changed, 9 insertions, 61 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 547112ecf66..48f283e67b9 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -37,9 +37,6 @@
#include "MEM_guardedalloc.h"
-#include "DNA_listBase.h"
-#include "DNA_vec_types.h"
-
#include "BLI_math.h"
#include "BLI_threads.h"
@@ -47,7 +44,6 @@
#include "IMB_colormanagement.h"
-#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
@@ -61,9 +57,6 @@
*/
#define BLF_MAX_FONT 16
-/* call BLF_default_set first! */
-#define ASSERT_DEFAULT_SET BLI_assert(global_font_default != -1)
-
#define BLF_RESULT_CHECK_INIT(r_info) \
if (r_info) { \
memset(r_info, 0, sizeof(*(r_info))); \
@@ -73,11 +66,6 @@
/* Font array. */
static FontBLF *global_font[BLF_MAX_FONT] = {NULL};
-/* Default size and dpi, for BLF_draw_default. */
-static int global_font_default = -1;
-static int global_font_points = 11;
-static int global_font_dpi = 72;
-
/* XXX, should these be made into global_font_'s too? */
int blf_mono_font = -1;
int blf_mono_font_render = -1;
@@ -96,17 +84,11 @@ int BLF_init(void)
global_font[i] = NULL;
}
- global_font_points = 11;
- global_font_dpi = 72;
+ BLF_default_dpi(72);
return blf_font_init();
}
-void BLF_default_dpi(int dpi)
-{
- global_font_dpi = dpi;
-}
-
void BLF_exit(void)
{
for (int i = 0; i < BLF_MAX_FONT; i++) {
@@ -131,6 +113,11 @@ void BLF_cache_clear(void)
}
}
+bool blf_font_id_is_valid(int fontid)
+{
+ return blf_get(fontid) != NULL;
+}
+
static int blf_search(const char *name)
{
for (int i = 0; i < BLF_MAX_FONT; i++) {
@@ -154,20 +141,6 @@ static int blf_search_available(void)
return -1;
}
-void BLF_default_set(int fontid)
-{
- FontBLF *font = blf_get(fontid);
- if (font || fontid == -1) {
- global_font_default = fontid;
- }
-}
-
-int BLF_default(void)
-{
- ASSERT_DEFAULT_SET;
- return global_font_default;
-}
-
bool BLF_has_glyph(int fontid, unsigned int unicode)
{
FontBLF *font = blf_get(fontid);
@@ -514,34 +487,6 @@ void BLF_batch_draw_end(void)
g_batch.enabled = false;
}
-void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
-{
- ASSERT_DEFAULT_SET;
-
- BLF_size(global_font_default, global_font_points, global_font_dpi);
- BLF_position(global_font_default, x, y, z);
- BLF_draw(global_font_default, str, len);
-}
-
-/* same as above but call 'BLF_draw_ascii' */
-void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len)
-{
- ASSERT_DEFAULT_SET;
-
- BLF_size(global_font_default, global_font_points, global_font_dpi);
- BLF_position(global_font_default, x, y, z);
- BLF_draw_ascii(global_font_default, str, len); /* XXX, use real length */
-}
-
-int BLF_set_default(void)
-{
- ASSERT_DEFAULT_SET;
-
- BLF_size(global_font_default, global_font_points, global_font_dpi);
-
- return global_font_default;
-}
-
static void blf_draw_gl__start(FontBLF *font)
{
/*
@@ -600,6 +545,9 @@ void BLF_draw(int fontid, const char *str, size_t len)
return;
}
+ /* Avoid bgl usage to corrupt BLF drawing. */
+ GPU_bgl_end();
+
BLF_draw_ex(fontid, str, len, NULL);
}