Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifdef HAVE_CONFIG_H
00011 # include <config.h>
00012 #endif
00013
00014 #define DISABLE_DEBUGLOG
00015
00016
00017 #include "o_word_l.h"
00018 #include "htmlctx_l.h"
00019
00020 #include <gwenhywfar/debug.h>
00021
00022
00023
00024 static int HtmlObject_Word_Layout(HTML_OBJECT *o) {
00025 const char *s;
00026 int w=0;
00027 int h=0;
00028
00029 s=HtmlObject_GetText(o);
00030 if (s) {
00031 HTML_PROPS *pr;
00032 HTML_FONT *fnt;
00033
00034 pr=HtmlObject_GetProperties(o);
00035 assert(pr);
00036 fnt=HtmlProps_GetFont(pr);
00037 w=HtmlCtx_GetTextWidth(HtmlObject_GetXmlCtx(o), fnt, s)+(HtmlFont_GetFontSize(fnt)/2);
00038 h=HtmlCtx_GetTextHeight(HtmlObject_GetXmlCtx(o), fnt, s);
00039 }
00040
00041 HtmlObject_SetWidth(o, w);
00042 HtmlObject_SetHeight(o, h);
00043 return 0;
00044 }
00045
00046
00047
00048 HTML_OBJECT *HtmlObject_Word_new(GWEN_XML_CONTEXT *ctx, const char *s) {
00049 HTML_OBJECT *o;
00050
00051 o=HtmlObject_new(ctx, HtmlObjectType_Word);
00052 HtmlObject_SetText(o, s);
00053 HtmlObject_SetLayoutFn(o, HtmlObject_Word_Layout);
00054
00055 return o;
00056 }
00057
00058