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:
authorTon Roosendaal <ton@blender.org>2009-04-10 20:30:28 +0400
committerTon Roosendaal <ton@blender.org>2009-04-10 20:30:28 +0400
commit4e81404d7eb00d7373ea8e4c01ae8bdfad287d72 (patch)
treee0414e0bea32707785061910589d173c112756a6 /source/blender/editors/interface
parent61249337817d3699ca961c9e4007cb0cdb232051 (diff)
2.5
Grand cleanup: - removal of FTF and ftfont dir - removal of text.c which wrapped it - wrapped old text drawing code temporarily, need to decide how 'style' will behave per editor when you draw strings outside interface code.... wouldn't be very useful to set fonts locally all over?
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c98
-rw-r--r--source/blender/editors/interface/interface_draw.c35
-rw-r--r--source/blender/editors/interface/interface_handlers.c11
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/interface/interface_intern.h1
-rw-r--r--source/blender/editors/interface/interface_panel.c1
-rw-r--r--source/blender/editors/interface/interface_regions.c35
-rw-r--r--source/blender/editors/interface/interface_style.c21
-rw-r--r--source/blender/editors/interface/text.c276
-rw-r--r--source/blender/editors/interface/view2d.c9
10 files changed, 57 insertions, 434 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index ea3b1ca3bce..c397c3c2ecc 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -55,12 +55,6 @@
#include "BLF_api.h"
#include "UI_interface.h"
-#include "UI_text.h"
-
-#include "BMF_Api.h"
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
#include "ED_screen.h"
@@ -88,10 +82,6 @@
static void ui_free_but(const bContext *C, uiBut *but);
static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but);
-/* ************ GLOBALS ************* */
-
-static uiFontOld UIfont[UI_ARRAY]; // no init needed
-
/* ************* translation ************** */
int ui_translate_buttons()
@@ -1718,82 +1708,6 @@ void ui_set_but_soft_range(uiBut *but, double value)
}
}
-/* ******************* Font ********************/
-
-static void ui_set_ftf_font(float aspect)
-{
-#ifdef INTERNATIONAL
- if(aspect<1.15) {
- FTF_SetFontSize('l');
- }
- else if(aspect<1.59) {
- FTF_SetFontSize('m');
- }
- else {
- FTF_SetFontSize('s');
- }
-#endif
-}
-
-void uiSetCurFont(uiBlock *block, int index)
-{
- ui_set_ftf_font(block->aspect);
-
- if(block->aspect<0.60) {
- block->curfont= UIfont[index].xl;
- }
- else if(block->aspect<1.15) {
- block->curfont= UIfont[index].large;
- }
- else if(block->aspect<1.59) {
- block->curfont= UIfont[index].medium;
- }
- else {
- block->curfont= UIfont[index].small;
- }
-
- if(block->curfont==NULL) block->curfont= UIfont[index].large;
- if(block->curfont==NULL) block->curfont= UIfont[index].medium;
- if(block->curfont==NULL) printf("error block no font %s\n", block->name);
-
-}
-
-/* called by node editor */
-void *uiSetCurFont_ext(float aspect)
-{
- void *curfont;
-
- ui_set_ftf_font(aspect);
-
- if(aspect<0.60) {
- curfont= UIfont[0].xl;
- }
- else if(aspect<1.15) {
- curfont= UIfont[0].large;
- }
- else if(aspect<1.59) {
- curfont= UIfont[0].medium;
- }
- else {
- curfont= UIfont[0].small;
- }
-
- if(curfont==NULL) curfont= UIfont[0].large;
- if(curfont==NULL) curfont= UIfont[0].medium;
-
- return curfont;
-}
-
-void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small)
-{
- if(index>=UI_ARRAY) return;
-
- UIfont[index].xl= xl;
- UIfont[index].large= large;
- UIfont[index].medium= medium;
- UIfont[index].small= small;
-}
-
/* ******************* Free ********************/
static void ui_free_link(uiLink *link)
@@ -3271,24 +3185,12 @@ void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1,
void UI_init(void)
{
- uiDefFont(UI_HELVB,
- BMF_GetFont(BMF_kHelveticaBold14),
- BMF_GetFont(BMF_kHelveticaBold12),
- BMF_GetFont(BMF_kHelveticaBold10),
- BMF_GetFont(BMF_kHelveticaBold8));
- uiDefFont(UI_HELV,
- BMF_GetFont(BMF_kHelvetica12),
- BMF_GetFont(BMF_kHelvetica12),
- BMF_GetFont(BMF_kHelvetica10),
- BMF_GetFont(BMF_kHelveticaBold8));
-
ui_resources_init();
}
void UI_init_userdef()
{
uiStyleInit();
- ui_text_init_userdef();
ui_theme_init_userdef();
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index fc3808a6608..fd99e6b84a0 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -48,12 +48,6 @@
#include "UI_interface.h"
#include "UI_interface_icons.h"
-#include "UI_text.h"
-
-#include "BMF_Api.h"
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
#include "interface_intern.h"
@@ -453,35 +447,6 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
}
-/* ************** safe rasterpos for pixmap alignment with pixels ************* */
-
-void ui_rasterpos_safe(float x, float y, float aspect)
-{
- float vals[4], remainder;
- int doit=0;
-
- glRasterPos2f(x, y);
- glGetFloatv(GL_CURRENT_RASTER_POSITION, vals);
-
- remainder= vals[0] - floor(vals[0]);
- if(remainder > 0.4 && remainder < 0.6) {
- if(remainder < 0.5) x -= 0.1*aspect;
- else x += 0.1*aspect;
- doit= 1;
- }
- remainder= vals[1] - floor(vals[1]);
- if(remainder > 0.4 && remainder < 0.6) {
- if(remainder < 0.5) y -= 0.1*aspect;
- else y += 0.1*aspect;
- doit= 1;
- }
-
- if(doit) glRasterPos2f(x, y);
-
- UI_RasterPos(x, y);
- UI_SetScale(aspect);
-}
-
/* ************** generic embossed rect, for window sliders etc ************* */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b41fe7b9b7d..cebf4f255f8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -51,7 +51,9 @@
#include "ED_screen.h"
#include "UI_interface.h"
-#include "UI_text.h"
+
+#include "BLF_api.h"
+
#include "interface_intern.h"
#include "RNA_access.h"
@@ -807,14 +809,17 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, short x)
{
+ uiStyle *style= U.uistyles.first; // XXX pass on as arg
char *origstr;
-
+
+ uiStyleFontSet(&style->widget);
+
origstr= MEM_callocN(sizeof(char)*(data->maxlen+1), "ui_textedit origstr");
BLI_strncpy(origstr, but->drawstr, data->maxlen+1);
but->pos= strlen(origstr)-but->ofs;
- while((but->aspect*UI_GetStringWidth(but->font, origstr+but->ofs, 0) + but->x1) > x) {
+ while((BLF_width(origstr+but->ofs) + but->x1) > x) {
if (but->pos <= 0) break;
but->pos--;
origstr[but->pos+but->ofs] = 0;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index f2f0582a5e2..0c97c1fd008 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -831,7 +831,9 @@ static void icon_set_image(ID *id, DrawInfo *di, PreviewImage* prv_img, int mipl
static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect)
{
- ui_rasterpos_safe(x, y, aspect);
+
+ glRasterPos2f(x, y);
+ // XXX ui_rasterpos_safe(x, y, aspect);
if((w<1 || h<1)) {
// XXX - TODO 2.5 verify whether this case can happen
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 84ce8ed5ec0..b62ba386330 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -366,7 +366,6 @@ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
extern void ui_draw_panel(struct ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
/* interface_draw.c */
-extern void ui_rasterpos_safe(float x, float y, float aspect);
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 6d7a0eae6af..5f365d3d7dc 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -59,7 +59,6 @@
#include "ED_screen.h"
#include "UI_interface.h"
-#include "UI_text.h"
#include "UI_view2d.h"
#include "interface_intern.h"
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 475f19b0cbd..85091fc45c2 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -32,6 +32,7 @@
#include "DNA_screen_types.h"
#include "DNA_view2d_types.h"
+#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_arithb.h"
@@ -54,9 +55,10 @@
#include "BIF_gl.h"
#include "UI_interface.h"
-#include "UI_text.h"
#include "UI_view2d.h"
+#include "BLF_api.h"
+
#include "ED_screen.h"
#include "interface_intern.h"
@@ -259,6 +261,7 @@ typedef struct uiTooltipData {
static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
{
+ uiStyle *style= U.uistyles.first; // XXX pass on as arg
uiTooltipData *data;
int x1, y1, x2, y2;
@@ -283,10 +286,10 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
* an equal gap between the top of the background box and the top of the
* string's bbox, and the bottom of the background box, and the bottom of
* the string's bbox */
- ui_rasterpos_safe(5, ((y2-data->bbox.ymax)+(y1+data->bbox.ymin))/2 - data->bbox.ymin - y1, data->aspect);
- UI_SetScale(1.0);
-
- UI_DrawString(data->font, data->tip, ui_translate_tooltips());
+
+ uiStyleFontSet(&style->widget);
+ BLF_position(5, ((y2-data->bbox.ymax)+(y1+data->bbox.ymin))/2 - data->bbox.ymin - y1, 0.0f);
+ BLF_draw(data->tip);
}
static void ui_tooltip_region_free(ARegion *ar)
@@ -301,6 +304,7 @@ static void ui_tooltip_region_free(ARegion *ar)
ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
{
+ uiStyle *style= U.uistyles.first; // XXX pass on as arg
static ARegionType type;
ARegion *ar;
uiTooltipData *data;
@@ -322,7 +326,10 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
data->tip= BLI_strdup(but->tip);
data->font= but->font;
data->aspect= but->aspect;
- UI_GetBoundingBox(data->font, data->tip, ui_translate_tooltips(), &data->bbox);
+
+ /* set font, get bb */
+ uiStyleFontSet(&style->widget);
+ BLF_boundbox(data->tip, &data->bbox);
ar->regiondata= data;
@@ -759,12 +766,12 @@ uiBlock *ui_block_func_MENU(bContext *C, uiPopupBlockHandle *handle, void *arg_b
/* size and location */
if(md->title)
- width= 1.5*aspect*strlen(md->title)+UI_GetStringWidth(block->curfont, md->title, ui_translate_menus());
+ width= 1.5*aspect*strlen(md->title)+UI_GetStringWidth(md->title);
else
width= 0;
for(a=0; a<md->nitems; a++) {
- xmax= aspect*UI_GetStringWidth(block->curfont, md->items[a].str, ui_translate_menus());
+ xmax= aspect*UI_GetStringWidth(md->items[a].str);
if(md->items[a].icon)
xmax += 20*aspect;
if(xmax>width)
@@ -872,12 +879,12 @@ uiBlock *ui_block_func_ICONTEXTROW(bContext *C, uiPopupBlockHandle *handle, void
/* size and location */
/* expand menu width to fit labels */
if(md->title)
- width= 2*strlen(md->title)+UI_GetStringWidth(block->curfont, md->title, ui_translate_menus());
+ width= 2*strlen(md->title)+UI_GetStringWidth(md->title);
else
width= 0;
for(a=0; a<md->nitems; a++) {
- xmax= UI_GetStringWidth(block->curfont, md->items[a].str, ui_translate_menus());
+ xmax= UI_GetStringWidth(md->items[a].str);
if(xmax>width) width= xmax;
}
@@ -1347,13 +1354,13 @@ uiBlock *ui_block_func_PUPMENU(bContext *C, uiPopupBlockHandle *handle, void *ar
/* size and location, title slightly bigger for bold */
if(md->title) {
- width= 2*strlen(md->title)+UI_GetStringWidth(uiBlockGetCurFont(block), md->title, ui_translate_buttons());
+ width= 2*strlen(md->title)+UI_GetStringWidth(md->title);
width /= columns;
}
else width= 0;
for(a=0; a<md->nitems; a++) {
- xmax= UI_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, ui_translate_buttons());
+ xmax= UI_GetStringWidth(md->items[a].str);
if(xmax>width) width= xmax;
if(strcmp(md->items[a].str, "%l")==0) height+= PUP_LABELH;
@@ -1520,13 +1527,13 @@ uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiPopupBlockHandle *handle, void
/* size and location, title slightly bigger for bold */
if(md->title) {
- width= 2*strlen(md->title)+UI_GetStringWidth(uiBlockGetCurFont(block), md->title, ui_translate_buttons());
+ width= 2*strlen(md->title)+UI_GetStringWidth(md->title);
width /= columns;
}
else width= 0;
for(a=0; a<md->nitems; a++) {
- xmax= UI_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, ui_translate_buttons());
+ xmax= UI_GetStringWidth(md->items[a].str);
if(xmax>width) width= xmax;
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 82ff20b2495..ca773277132 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -52,7 +52,6 @@
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
-#include "UI_text.h"
#include "UI_view2d.h"
#include "ED_datafiles.h"
@@ -178,6 +177,26 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
BLF_disable(BLF_CLIPPING);
}
+/* ************** helpers ************************ */
+
+/* temporarily, does widget font */
+int UI_GetStringWidth(char *str)
+{
+ uiStyle *style= U.uistyles.first;
+
+ uiStyleFontSet(&style->widget);
+ return BLF_width(str);
+}
+
+/* temporarily, does widget font */
+void UI_DrawString(float x, float y, char *str)
+{
+ uiStyle *style= U.uistyles.first;
+
+ uiStyleFontSet(&style->widget);
+ BLF_position(x, y, 0.0f);
+ BLF_draw(str);
+}
/* ************** init exit ************************ */
diff --git a/source/blender/editors/interface/text.c b/source/blender/editors/interface/text.c
deleted file mode 100644
index c3dc40e59ef..00000000000
--- a/source/blender/editors/interface/text.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is written by Rob Haarsma (phase)
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/* XXX 2.50 this file must be cleanup still, using globals etc. */
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vec_types.h"
-
-#include "BKE_global.h" /* G */
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_linklist.h" /* linknode */
-
-#include "BIF_gl.h"
-#include "UI_text.h"
-#include "BLF_api.h"
-
-#include "ED_datafiles.h"
-
-#include "BMF_Api.h"
-
-#ifdef WITH_ICONV
-#include "iconv.h"
-
-void string_to_utf8(char *original, char *utf_8, char *code)
-{
- size_t inbytesleft=strlen(original);
- size_t outbytesleft=512;
- size_t rv=0;
- iconv_t cd;
-
- cd=iconv_open("UTF-8", code);
-
- if (cd == (iconv_t)(-1)) {
- printf("iconv_open Error");
- *utf_8='\0';
- return ;
- }
- rv=iconv(cd, &original, &inbytesleft, &utf_8, &outbytesleft);
- if (rv == (size_t) -1) {
- printf("iconv Error\n");
- return ;
- }
- *utf_8 = '\0';
- iconv_close(cd);
-}
-#endif // WITH_ICONV
-
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
-
-void UI_RasterPos(float x, float y)
-{
-#ifdef INTERNATIONAL
- FTF_SetPosition(x, y);
-#endif // INTERNATIONAL
-}
-
-void UI_SetScale(float aspect)
-{
-#ifdef INTERNATIONAL
- FTF_SetScale(aspect);
-#endif // INTERNATIONAL
-}
-
-void ui_text_init_userdef(void)
-{
- int id;
-
- id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
- if (id == -1)
- printf("Warning can't load built-in font ??\n");
- else {
- BLF_set(id);
- BLF_size(12, 72);
- BLF_size(11, 96);
- BLF_size(14, 96);
- }
-
-#ifdef INTERNATIONAL
- if(U.transopts & USER_DOTRANSLATE)
- start_interface_font();
- else
- G.ui_international= FALSE;
-#else // INTERNATIONAL
- G.ui_international= FALSE;
-#endif
-}
-
-int UI_DrawString(BMF_Font* font, char *str, int translate)
-{
-#ifdef INTERNATIONAL
- if(G.ui_international == TRUE) {
- if(translate)
- {
-#ifdef WITH_ICONV
- if(translate & CONVERT_TO_UTF8) {
- char utf_8[512];
- char *code;
-
- code= BLF_lang_find_code(U.language);
- if (lme) {
- if (!strcmp(code, "ja_JP"))
- string_to_utf8(str, utf_8, "Shift_JIS"); /* Japanese */
- else if (!strcmp(code, "zh_CN"))
- string_to_utf8(str, utf_8, "GB2312"); /* Chinese */
- }
- return FTF_DrawString(utf_8, FTF_INPUT_UTF8);
- }
- else
-#endif // WITH_ICONV
- return FTF_DrawString(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- }
- else
- return FTF_DrawString(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
- } else {
- return BMF_DrawString(font, str);
- }
-#else // INTERNATIONAL
- return BMF_DrawString(font, str);
-#endif
-}
-
-float UI_GetStringWidth(BMF_Font* font, char *str, int translate)
-{
- float rt;
-
-#ifdef INTERNATIONAL
- if(G.ui_international == TRUE)
- if(translate && (U.transopts & USER_TR_BUTTONS))
- rt= FTF_GetStringWidth(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- else
- rt= FTF_GetStringWidth(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
- else
- rt= BMF_GetStringWidth(font, str);
-#else
- rt= BMF_GetStringWidth(font, str);
-#endif
-
- return rt;
-}
-
-void UI_GetBoundingBox(struct BMF_Font* font, char* str, int translate, rctf *bbox)
-{
-#ifdef INTERNATIONAL
- float dummy;
- if(G.ui_international == TRUE)
- if(translate && (U.transopts & USER_TR_BUTTONS))
- FTF_GetBoundingBox(str, &bbox->xmin, &bbox->ymin, &dummy, &bbox->xmax, &bbox->ymax, &dummy, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- else
- FTF_GetBoundingBox(str, &bbox->xmin, &bbox->ymin, &dummy, &bbox->xmax, &bbox->ymax, &dummy, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
- else
- BMF_GetStringBoundingBox(font, str, &bbox->xmin, &bbox->ymin, &bbox->xmax, &bbox->ymax);
-#else
- BMF_GetStringBoundingBox(font, str, &bbox->xmin, &bbox->ymin, &bbox->xmax, &bbox->ymax);
-#endif
-}
-
-#ifdef INTERNATIONAL
-
-char *fontsize_pup(void)
-{
- static char string[1024];
- char formatstring[1024];
-
- strcpy(formatstring, "Choose Font Size: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
-
- sprintf(string, formatstring,
- "Font Size: 8", 8,
- "Font Size: 9", 9,
- "Font Size: 10", 10,
- "Font Size: 11", 11,
- "Font Size: 12", 12,
- "Font Size: 13", 13,
- "Font Size: 14", 14,
- "Font Size: 15", 15,
- "Font Size: 16", 16
- );
-
- return (string);
-}
-
-/* called from fileselector */
-void set_interface_font(char *str)
-{
-
- /* this test needed because fileselect callback can happen after disable AA fonts */
- if(U.transopts & USER_DOTRANSLATE) {
- if(FTF_SetFont((unsigned char*)str, 0, U.fontsize)) {
- BLF_lang_set(U.language);
- if(strlen(str) < FILE_MAXDIR) strcpy(U.fontname, str);
- G.ui_international = TRUE;
- }
- else {
- U.fontname[0]= 0;
- FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- G.ui_international = TRUE; // this case will switch to standard font
- /* XXX 2.50 bad call okee("Invalid font selection - reverting to built-in font."); */
- }
- /* XXX 2.50 bad call allqueue(REDRAWALL, 0); */
- }
-}
-
-void start_interface_font(void)
-{
- int result = 0;
-
- if(U.transopts & USER_USETEXTUREFONT)
- FTF_SetMode(FTF_TEXTUREFONT);
- else
- FTF_SetMode(FTF_PIXMAPFONT);
-
- if(U.fontsize && U.fontname[0] ) { // we have saved user settings + fontpath
-
- // try loading font from U.fontname = full path to font in usersettings
- result = FTF_SetFont((unsigned char*)U.fontname, 0, U.fontsize);
- }
- else if(U.fontsize) { // user settings, default
- result = FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- }
-
- if(result==0) { // use default
- U.language= 0;
- U.fontsize= 11;
- U.encoding= 0;
- U.fontname[0]= 0;
- result = FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- }
-
- if(result) {
- BLF_lang_set(U.language);
- G.ui_international = TRUE;
- }
- else {
- printf("no font found for international support\n");
- G.ui_international = FALSE;
- U.transopts &= ~USER_DOTRANSLATE;
- U.fontsize = 0;
- }
-
- /* XXX 2.50 bad call allqueue(REDRAWALL, 0); */
-}
-
-#endif /* INTERNATIONAL */
-
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 98aa16c84e4..34c8bfaab74 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -49,11 +49,12 @@
#include "ED_screen.h"
+#include "BMF_Api.h"
+
+#include "UI_interface.h"
#include "UI_resources.h"
-#include "UI_text.h"
#include "UI_view2d.h"
-#include "UI_interface.h"
#include "interface_intern.h"
/* *********************************************************************** */
@@ -1373,8 +1374,8 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f
}
/* draw it */
- ui_rasterpos_safe(x, y, 1.0);
- UI_DrawString(G.fonts, str, 0); // XXX check this again when new text-drawing api is done
+ glRasterPos2f(x, y);
+ BMF_DrawString(G.fonts, str); // XXX check this again when new text-drawing api is done
}
/* local defines for scrollers drawing */