|
Blender
V2.59
|
00001 /* 00002 * $Id: blf_internal_types.h 36390 2011-04-30 08:54:06Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2008 Blender Foundation. 00021 * All rights reserved. 00022 * 00023 * Contributor(s): Blender Foundation. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #ifndef BLF_INTERNAL_TYPES_H 00034 #define BLF_INTERNAL_TYPES_H 00035 00036 typedef struct GlyphCacheBLF { 00037 struct GlyphCacheBLF *next; 00038 struct GlyphCacheBLF *prev; 00039 00040 /* font size. */ 00041 int size; 00042 00043 /* and dpi. */ 00044 int dpi; 00045 00046 /* and the glyphs. */ 00047 ListBase bucket[257]; 00048 00049 /* texture array, to draw the glyphs. */ 00050 GLuint *textures; 00051 00052 /* size of the array. */ 00053 int ntex; 00054 00055 /* and the last texture, aka. the current texture. */ 00056 int cur_tex; 00057 00058 /* like bftgl, we draw every glyph in a big texture, so this is the 00059 * current position inside the texture. 00060 */ 00061 int x_offs; 00062 int y_offs; 00063 00064 /* and the space from one to other. */ 00065 unsigned int pad; 00066 00067 /* and the bigger glyph in the font. */ 00068 int max_glyph_width; 00069 int max_glyph_height; 00070 00071 /* next two integer power of two, to build the texture. */ 00072 int p2_width; 00073 int p2_height; 00074 00075 /* number of glyphs in the font. */ 00076 int num_glyphs; 00077 00078 /* number of glyphs that we load here. */ 00079 int rem_glyphs; 00080 00081 /* ascender and descender value. */ 00082 float ascender; 00083 float descender; 00084 } GlyphCacheBLF; 00085 00086 typedef struct GlyphBLF { 00087 struct GlyphBLF *next; 00088 struct GlyphBLF *prev; 00089 00090 /* and the character, as UTF8 */ 00091 unsigned int c; 00092 00093 /* freetype2 index, to speed-up the search. */ 00094 FT_UInt idx; 00095 00096 /* glyph box. */ 00097 rctf box; 00098 00099 /* advance size. */ 00100 float advance; 00101 00102 /* texture id where this glyph is store. */ 00103 GLuint tex; 00104 00105 /* position inside the texture where this glyph is store. */ 00106 int xoff; 00107 int yoff; 00108 00109 /* Bitmap data, from freetype. Take care that this 00110 * can be NULL. 00111 */ 00112 unsigned char *bitmap; 00113 00114 /* glyph width and height. */ 00115 int width; 00116 int height; 00117 int pitch; 00118 00119 /* uv coords. */ 00120 float uv[2][2]; 00121 00122 /* X and Y bearing of the glyph. 00123 * The X bearing is from the origin to the glyph left bbox edge. 00124 * The Y bearing is from the baseline to the top of the glyph edge. 00125 */ 00126 float pos_x; 00127 float pos_y; 00128 00129 /* with value of zero mean that we need build the texture. */ 00130 short build_tex; 00131 } GlyphBLF; 00132 00133 typedef struct FontBLF { 00134 /* font name. */ 00135 char *name; 00136 00137 /* filename or NULL. */ 00138 char *filename; 00139 00140 /* aspect ratio or scale. */ 00141 float aspect[3]; 00142 00143 /* initial position for draw the text. */ 00144 float pos[3]; 00145 00146 /* angle in degrees. */ 00147 float angle; 00148 00149 /* blur: 3 or 5 large kernel */ 00150 int blur; 00151 00152 /* shadow level. */ 00153 int shadow; 00154 00155 /* and shadow offset. */ 00156 int shadow_x; 00157 int shadow_y; 00158 00159 /* shadow color. */ 00160 float shadow_col[4]; 00161 00162 /* Multiplied this matrix with the current one before 00163 * draw the text! see blf_draw__start. 00164 */ 00165 double m[16]; 00166 00167 /* clipping rectangle. */ 00168 rctf clip_rec; 00169 00170 /* font dpi (default 72). */ 00171 int dpi; 00172 00173 /* font size. */ 00174 int size; 00175 00176 /* max texture size. */ 00177 int max_tex_size; 00178 00179 /* font options. */ 00180 int flags; 00181 00182 /* list of glyph cache for this font. */ 00183 ListBase cache; 00184 00185 /* current glyph cache, size and dpi. */ 00186 GlyphCacheBLF *glyph_cache; 00187 00188 /* fast ascii lookip */ 00189 GlyphBLF *glyph_ascii_table[256]; 00190 00191 /* freetype2 lib handle. */ 00192 FT_Library ft_lib; 00193 00194 /* freetype2 face. */ 00195 FT_Face face; 00196 00197 /* for draw to buffer, always set this to NULL after finish! */ 00198 float *b_fbuf; 00199 00200 /* the same but unsigned char */ 00201 unsigned char *b_cbuf; 00202 00203 /* buffer size, keep signed so comparisons with negative values work */ 00204 int bw; 00205 int bh; 00206 00207 /* number of channels. */ 00208 int bch; 00209 00210 /* and the color, the alphas is get from the glyph! */ 00211 float b_col[4]; 00212 } FontBLF; 00213 00214 typedef struct DirBLF { 00215 struct DirBLF *next; 00216 struct DirBLF *prev; 00217 00218 /* full path where search fonts. */ 00219 char *path; 00220 } DirBLF; 00221 00222 #endif /* BLF_INTERNAL_TYPES_H */