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_internal_types.h')
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h54
1 files changed, 48 insertions, 6 deletions
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 5723f08d44b..999773d0212 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -31,6 +31,37 @@
#ifndef __BLF_INTERNAL_TYPES_H__
#define __BLF_INTERNAL_TYPES_H__
+#include "../../../intern/gawain/gawain/gwn_vertex_buffer.h"
+#include "GPU_texture.h"
+
+#define BLF_BATCH_DRAW_LEN_MAX 2048 /* in glyph */
+
+typedef struct BatchBLF {
+ struct FontBLF *font; /* can only batch glyph from the same font */
+ struct Gwn_Batch *batch;
+ struct Gwn_VertBuf *verts;
+ struct Gwn_VertBufRaw pos_step, tex_step, col_step;
+ unsigned int pos_loc, tex_loc, col_loc;
+ unsigned int glyph_len;
+ float ofs[2]; /* copy of font->pos */
+ float mat[4][4]; /* previous call modelmatrix. */
+ bool enabled, active, simple_shader;
+ GPUTexture *tex_bind_state;
+} BatchBLF;
+
+extern BatchBLF g_batch;
+
+typedef struct KerningCacheBLF {
+ struct KerningCacheBLF *next, *prev;
+
+ /* kerning mode. */
+ FT_UInt mode;
+
+ /* only cache a ascii glyph pairs. Only store the x
+ * offset we are interested in, instead of the full FT_Vector. */
+ int table[0x80][0x80];
+} KerningCacheBLF;
+
typedef struct GlyphCacheBLF {
struct GlyphCacheBLF *next;
struct GlyphCacheBLF *prev;
@@ -48,7 +79,7 @@ typedef struct GlyphCacheBLF {
struct GlyphBLF *glyph_ascii_table[256];
/* texture array, to draw the glyphs. */
- unsigned int *textures;
+ GPUTexture **textures;
/* size of the array. */
unsigned int textures_len;
@@ -103,7 +134,7 @@ typedef struct GlyphBLF {
int advance_i;
/* texture id where this glyph is store. */
- unsigned int tex;
+ GPUTexture *tex;
/* position inside the texture where this glyph is store. */
int offset_x;
@@ -175,8 +206,10 @@ typedef struct FontBLF {
/* angle in radians. */
float angle;
+#if 0 /* BLF_BLUR_ENABLE */
/* blur: 3 or 5 large kernel */
int blur;
+#endif
/* shadow level. */
int shadow;
@@ -186,10 +219,10 @@ typedef struct FontBLF {
int shadow_y;
/* shadow color. */
- float shadow_col[4];
+ unsigned char shadow_color[4];
- /* store color here when drawing shadow or blur. */
- float orig_col[4];
+ /* main text color. */
+ unsigned char color[4];
/* Multiplied this matrix with the current one before
* draw the text! see blf_draw__start.
@@ -212,7 +245,7 @@ typedef struct FontBLF {
int tex_size_max;
/* cache current OpenGL texture to save calls into the API */
- unsigned int tex_bind_state;
+ GPUTexture *tex_bind_state;
/* font options. */
int flags;
@@ -223,6 +256,12 @@ typedef struct FontBLF {
/* current glyph cache, size and dpi. */
GlyphCacheBLF *glyph_cache;
+ /* list of kerning cache for this font. */
+ ListBase kerning_caches;
+
+ /* current kerning cache for this font and kerning mode. */
+ KerningCacheBLF *kerning_cache;
+
/* freetype2 lib handle. */
FT_Library ft_lib;
@@ -232,6 +271,9 @@ typedef struct FontBLF {
/* freetype2 face. */
FT_Face face;
+ /* freetype kerning */
+ FT_UInt kerning_mode;
+
/* data for buffer usage (drawing into a texture buffer) */
FontBufInfoBLF buf_info;
} FontBLF;