Blender  V2.59
blf_internal.h
Go to the documentation of this file.
00001 /*
00002  * $Id: blf_internal.h 36594 2011-05-10 13:11:36Z 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) 2009 Blender Foundation.
00021  * All rights reserved.
00022  * 
00023  * Contributor(s): Blender Foundation.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #ifndef BLF_INTERNAL_H
00034 #define BLF_INTERNAL_H
00035 
00036 struct FontBLF;
00037 struct GlyphBLF;
00038 struct GlyphCacheBLF;
00039 struct rctf;
00040 
00041 unsigned int blf_next_p2(unsigned int x);
00042 unsigned int blf_hash(unsigned int val);
00043 int blf_utf8_next(unsigned char *buf, int *iindex);
00044 
00045 char *blf_dir_search(const char *file);
00046 char *blf_dir_metrics_search(const char *filename);
00047 // int blf_dir_split(const char *str, char *file, int *size); // UNUSED
00048 
00049 int blf_font_init(void);
00050 void blf_font_exit(void);
00051 
00052 struct FontBLF *blf_font_new(const char *name, const char *filename);
00053 struct FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_size);
00054 void blf_font_attach_from_mem(struct FontBLF *font, const unsigned char *mem, int mem_size);
00055 
00056 void blf_font_size(struct FontBLF *font, int size, int dpi);
00057 void blf_font_draw(struct FontBLF *font, const char *str, unsigned int len);
00058 void blf_font_draw_ascii(struct FontBLF *font, const char *str, unsigned int len);
00059 void blf_font_buffer(struct FontBLF *font, const char *str);
00060 void blf_font_boundbox(struct FontBLF *font, const char *str, struct rctf *box);
00061 void blf_font_width_and_height(struct FontBLF *font, const char *str, float *width, float *height);
00062 float blf_font_width(struct FontBLF *font, const char *str);
00063 float blf_font_height(struct FontBLF *font, const char *str);
00064 float blf_font_fixed_width(struct FontBLF *font);
00065 void blf_font_free(struct FontBLF *font);
00066 
00067 struct GlyphCacheBLF *blf_glyph_cache_find(struct FontBLF *font, int size, int dpi);
00068 struct GlyphCacheBLF *blf_glyph_cache_new(struct FontBLF *font);
00069 void blf_glyph_cache_clear(struct FontBLF *font);
00070 void blf_glyph_cache_free(struct GlyphCacheBLF *gc);
00071 
00072 struct GlyphBLF *blf_glyph_search(struct GlyphCacheBLF *gc, unsigned int c);
00073 struct GlyphBLF *blf_glyph_add(struct FontBLF *font, unsigned int index, unsigned int c);
00074 
00075 void blf_glyph_free(struct GlyphBLF *g);
00076 int blf_glyph_render(struct FontBLF *font, struct GlyphBLF *g, float x, float y);
00077 
00078 #endif /* BLF_INTERNAL_H */