From 7774d03fd7eecef57c9c13476e832a5d6fb0aa4c Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Mon, 27 Sep 2010 15:36:45 +0000 Subject: [PATCH] update font engine. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@967 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- examples/gui/demo_view_ttf.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/examples/gui/demo_view_ttf.c b/examples/gui/demo_view_ttf.c index 23d74447d1..988f382985 100644 --- a/examples/gui/demo_view_ttf.c +++ b/examples/gui/demo_view_ttf.c @@ -46,19 +46,19 @@ rt_bool_t ttf_event_handler(rtgui_widget_t* widget, rtgui_event_t *event) saved = RTGUI_WIDGET_FONT(widget); RTGUI_WIDGET_FONT(widget) = font_16; - rtgui_dc_draw_text(dc, "ABCD", &rect); + rtgui_dc_draw_text(dc, "ABCD中文", &rect); rect.y1 += 18; RTGUI_WIDGET_FONT(widget) = font_24; - rtgui_dc_draw_text(dc, "ABCD", &rect); + rtgui_dc_draw_text(dc, "ABCD中文", &rect); rect.y1 += 26; RTGUI_WIDGET_FONT(widget) = font_36; - rtgui_dc_draw_text(dc, "ABCD", &rect); + rtgui_dc_draw_text(dc, "ABCD中文", &rect); rect.y1 += 38; RTGUI_WIDGET_FONT(widget) = font_48; - rtgui_dc_draw_text(dc, "ABCD", &rect); + rtgui_dc_draw_text(dc, "ABCD中文", &rect); RTGUI_WIDGET_FONT(widget) = saved; /* 绘图完成 */ @@ -73,22 +73,20 @@ rt_bool_t ttf_event_handler(rtgui_widget_t* widget, rtgui_event_t *event) return RT_FALSE; } -extern rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int italic, rt_size_t size); - /* 创建用于TTF字体显示演示用的视图 */ rtgui_view_t *demo_view_ttf(rtgui_workbench_t* workbench) { rtgui_view_t *view; - font_16 = rtgui_freetype_font_create("d:/arial.ttf", 0, 0, 16); - font_24 = rtgui_freetype_font_create("d:/arial.ttf", 0, 0, 24); - font_36 = rtgui_freetype_font_create("d:/arial.ttf", 0, 0, 36); - font_48 = rtgui_freetype_font_create("d:/HARNGTON.TTF", 0, 0, 72); + font_16 = rtgui_freetype_font_create("d:/simsun.ttf", 0, 0, 16); + font_24 = rtgui_freetype_font_create("d:/simsun.ttf", 0, 0, 24); + font_36 = rtgui_freetype_font_create("d:/simsun.ttf", 0, 0, 36); + font_48 = rtgui_freetype_font_create("d:/simsun.TTF", 0, 0, 72); view = demo_view(workbench, "TTF 演示"); if (view != RT_NULL) { - // RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white; + RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white; /* 设置成自己的事件处理函数 */ rtgui_widget_set_event_handler(RTGUI_WIDGET(view), ttf_event_handler); }