Blender V2.61 - r43446
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ft2build.h>
#include "MEM_guardedalloc.h"
#include "DNA_vec_types.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BIF_gl.h"
#include "BLF_api.h"
#include "blf_internal_types.h"
#include "blf_internal.h"
Go to the source code of this file.
Defines | |
#define | BLF_UTF8_NEXT_FAST(_font, _g, _str, _i, _c, _glyph_ascii_table) |
#define | BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) |
#define | BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x) |
Functions | |
int | blf_font_init (void) |
void | blf_font_exit (void) |
void | blf_font_size (FontBLF *font, int size, int dpi) |
static void | blf_font_ensure_ascii_table (FontBLF *font) |
void | blf_font_draw (FontBLF *font, const char *str, unsigned int len) |
void | blf_font_draw_ascii (FontBLF *font, const char *str, unsigned int len) |
void | blf_font_buffer (FontBLF *font, const char *str) |
void | blf_font_boundbox (FontBLF *font, const char *str, rctf *box) |
void | blf_font_width_and_height (FontBLF *font, const char *str, float *width, float *height) |
float | blf_font_width (FontBLF *font, const char *str) |
float | blf_font_height (FontBLF *font, const char *str) |
float | blf_font_fixed_width (FontBLF *font) |
void | blf_font_free (FontBLF *font) |
static void | blf_font_fill (FontBLF *font) |
FontBLF * | blf_font_new (const char *name, const char *filename) |
void | blf_font_attach_from_mem (FontBLF *font, const unsigned char *mem, int mem_size) |
FontBLF * | blf_font_new_from_mem (const char *name, unsigned char *mem, int mem_size) |
Variables | |
static FT_Library | ft_lib |
Definition in file blf_font.c.
#define BLF_KERNING_STEP | ( | _font, | |
_kern_mode, | |||
_g_prev, | |||
_g, | |||
_delta, | |||
_pen_x | |||
) |
{ \ if (_g_prev) { \ _delta.x= _delta.y= 0; \ if (FT_Get_Kerning((_font)->face, \ (_g_prev)->idx, \ (_g)->idx, \ _kern_mode, \ &(_delta)) == 0) \ { \ _pen_x += delta.x >> 6; \ } \ } \ } \
Definition at line 145 of file blf_font.c.
Referenced by blf_font_boundbox(), blf_font_draw(), and blf_font_draw_ascii().
#define BLF_KERNING_VARS | ( | _font, | |
_has_kerning, | |||
_kern_mode | |||
) |
const short _has_kerning= FT_HAS_KERNING((_font)->face); \ const FT_UInt _kern_mode= (_has_kerning == 0) ? 0 : \ (((_font)->flags & BLF_KERNING_DEFAULT) ? \ ft_kerning_default : FT_KERNING_UNFITTED) \
Definition at line 138 of file blf_font.c.
Referenced by blf_font_boundbox(), blf_font_draw(), and blf_font_draw_ascii().
#define BLF_UTF8_NEXT_FAST | ( | _font, | |
_g, | |||
_str, | |||
_i, | |||
_c, | |||
_glyph_ascii_table | |||
) |
if(((_c)= (_str)[_i]) < 0x80) { \ _g= (_glyph_ascii_table)[_c]; \ _i++; \ } \ else if ((_c= BLI_str_utf8_as_unicode_step(_str, &(_i)))!=BLI_UTF8_ERR) { \ if ((_g= blf_glyph_search((_font)->glyph_cache, _c)) == NULL) { \ _g= blf_glyph_add(_font, \ FT_Get_Char_Index((_font)->face, _c), _c); \ } \ } \
Definition at line 125 of file blf_font.c.
Referenced by blf_font_boundbox(), and blf_font_draw().
void blf_font_attach_from_mem | ( | FontBLF * | font, |
const unsigned char * | mem, | ||
int | mem_size | ||
) |
Definition at line 548 of file blf_font.c.
References FontBLF::face.
Referenced by BLF_metrics_attach().
Definition at line 341 of file blf_font.c.
References GlyphBLF::advance, blf_font_ensure_ascii_table(), BLF_KERNING_STEP, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, GlyphBLF::box, g, GlyphCacheBLF::glyph_ascii_table, FontBLF::glyph_cache, NULL, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BLF_boundbox(), blf_font_height(), blf_font_width(), and blf_font_width_and_height().
void blf_font_buffer | ( | FontBLF * | font, |
const char * | str | ||
) |
Definition at line 215 of file blf_font.c.
References FontBLF::b_col, g, GlyphCacheBLF::glyph_ascii_table, FontBLF::glyph_cache, i, NULL, and FontBLF::pos.
Referenced by BLF_draw_buffer().
void blf_font_draw | ( | FontBLF * | font, |
const char * | str, | ||
unsigned int | len | ||
) |
Definition at line 160 of file blf_font.c.
References GlyphBLF::advance, blf_font_ensure_ascii_table(), blf_glyph_render(), BLF_KERNING_STEP, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, g, GlyphCacheBLF::glyph_ascii_table, FontBLF::glyph_cache, i, and NULL.
Referenced by BLF_draw().
void blf_font_draw_ascii | ( | FontBLF * | font, |
const char * | str, | ||
unsigned int | len | ||
) |
Definition at line 190 of file blf_font.c.
References GlyphBLF::advance, blf_font_ensure_ascii_table(), blf_glyph_render(), BLF_KERNING_STEP, BLF_KERNING_VARS, g, GlyphCacheBLF::glyph_ascii_table, FontBLF::glyph_cache, and NULL.
Referenced by BLF_draw_ascii().
static void blf_font_ensure_ascii_table | ( | FontBLF * | font | ) | [static] |
Definition at line 98 of file blf_font.c.
References blf_glyph_add(), blf_glyph_search(), FontBLF::face, g, GlyphCacheBLF::glyph_ascii_table, FontBLF::glyph_cache, i, and NULL.
Referenced by blf_font_boundbox(), blf_font_draw(), and blf_font_draw_ascii().
void blf_font_exit | ( | void | ) |
static void blf_font_fill | ( | FontBLF * | font | ) | [static] |
Definition at line 474 of file blf_font.c.
References FontBLF::angle, FontBLF::aspect, FontBLF::b_cbuf, FontBLF::b_col, FontBLF::b_fbuf, FontBLF::bch, FontBLF::bh, FontBLF::blur, FontBLF::bw, FontBLF::cache, FontBLF::clip_rec, FontBLF::dpi, ListBase::first, FontBLF::flags, ft_lib, FontBLF::ft_lib, FontBLF::glyph_cache, i, ListBase::last, FontBLF::m, FontBLF::max_tex_size, NULL, FontBLF::pos, FontBLF::size, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by blf_font_new(), and blf_font_new_from_mem().
float blf_font_fixed_width | ( | FontBLF * | font | ) |
Definition at line 439 of file blf_font.c.
References GlyphBLF::advance, blf_glyph_add(), blf_glyph_search(), FontBLF::face, g, and FontBLF::glyph_cache.
Referenced by BLF_fixed_width().
void blf_font_free | ( | FontBLF * | font | ) |
Definition at line 455 of file blf_font.c.
References blf_glyph_cache_free(), BLI_remlink(), FontBLF::cache, FontBLF::face, FontBLF::filename, ListBase::first, FontBLF::glyph_cache, MEM_freeN(), FontBLF::name, and NULL.
Referenced by BLF_exit(), and BLF_unload().
float blf_font_height | ( | FontBLF * | font, |
const char * | str | ||
) |
Definition at line 425 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), FontBLF::flags, rctf::ymax, and rctf::ymin.
Referenced by BLF_height().
int blf_font_init | ( | void | ) |
FontBLF* blf_font_new | ( | const char * | name, |
const char * | filename | ||
) | [read] |
Definition at line 512 of file blf_font.c.
References blf_dir_metrics_search(), blf_font_fill(), BLI_strdup(), err, FontBLF::face, FontBLF::filename, ft_lib, MEM_callocN(), MEM_freeN(), FontBLF::name, and NULL.
Referenced by BLF_load(), and BLF_load_unique().
FontBLF* blf_font_new_from_mem | ( | const char * | name, |
unsigned char * | mem, | ||
int | mem_size | ||
) | [read] |
Definition at line 558 of file blf_font.c.
References blf_font_fill(), BLI_strdup(), err, FontBLF::face, FontBLF::filename, ft_lib, MEM_callocN(), MEM_freeN(), FontBLF::name, and NULL.
Referenced by BLF_load_mem(), and BLF_load_mem_unique().
void blf_font_size | ( | FontBLF * | font, |
int | size, | ||
int | dpi | ||
) |
Definition at line 71 of file blf_font.c.
References blf_glyph_cache_find(), blf_glyph_cache_new(), FontBLF::dpi, err, FontBLF::face, FontBLF::glyph_cache, NULL, FontBLF::size, and size().
Referenced by BLF_size().
float blf_font_width | ( | FontBLF * | font, |
const char * | str | ||
) |
Definition at line 411 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), FontBLF::flags, rctf::xmax, and rctf::xmin.
Referenced by BLF_width().
void blf_font_width_and_height | ( | FontBLF * | font, |
const char * | str, | ||
float * | width, | ||
float * | height | ||
) |
Definition at line 392 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), FontBLF::flags, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BLF_width_and_height().
FT_Library ft_lib [static] |
Definition at line 59 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), blf_font_init(), blf_font_new(), and blf_font_new_from_mem().