diff options
author | Diego Borghetti <bdiego@gmail.com> | 2009-04-24 01:57:41 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2009-04-24 01:57:41 +0400 |
commit | efd1a69d6c12d97594c93857365547a56e6792e9 (patch) | |
tree | bf509b370b103c2b6db14a318f79dcf361030da5 /source/blender/editors | |
parent | 1b95d684afd7153a16ebb6d9af16b60b56fc1159 (diff) |
Move texture draw to blf_util.c, now both font used it.
A little cleanup on the internal font, it's possible load the old
bmfont with: BLF_load_mem(name, NULL, 0) where name can be: helv,
helvb or scr.
Note that the internal font also support both draw, texture and bitmap,
by default always used texture.
Remove some old lang function that I left there and don't exist any more
because the locale are now in the RNA.
Small changes to Style's, so if we build without freetype2 by default
go back to the internal font, this is a little ugly (and have the old
problem of scale) but now blender always show text (need work a little
more there).
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 99702097329..87e70523870 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -165,7 +165,11 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str) xofs= rect->xmax - rect->xmin - BLF_width(str); /* clip is very strict, so we give it some space */ - BLF_clipping(rect->xmin-4, rect->ymin-4, rect->xmax+4, rect->ymax+4); + if (BLF_type_get() == BLF_FONT_INTERNAL) + BLF_clipping(rect->xmin-4, rect->ymin-4, rect->xmax+8, rect->ymax+4); + else + BLF_clipping(rect->xmin-4, rect->ymin-4, rect->xmax+4, rect->ymax+4); + BLF_enable(BLF_CLIPPING); if(fs->shadow) @@ -229,12 +233,21 @@ void uiStyleInit(void) if(font->blf_id == -1) font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); } - + + if (font->blf_id == -1) { + /* when all fail, we go back to the internal font. */ + font->blf_id= BLF_load_mem("helv", NULL, 0); + } + if (font->blf_id == -1) printf("uiStyleInit error, no fonts available\n"); else { BLF_set(font->blf_id); - BLF_size(11, U.dpi); /* ? just for speed to initialize? */ + /* ? just for speed to initialize? + * Yes but only if we used the freetype2 library, + * this build the glyph cache and create the texture. + */ + BLF_size(11, U.dpi); BLF_size(12, U.dpi); BLF_size(14, U.dpi); } |