gwenhywfar
4.7.0beta
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
html
o_word.c
Go to the documentation of this file.
1
/***************************************************************************
2
begin : Sat Feb 20 2010
3
copyright : (C) 2010 by Martin Preuss
4
email : martin@libchipcard.de
5
6
***************************************************************************
7
* Please see toplevel file COPYING for license details *
8
***************************************************************************/
9
10
#ifdef HAVE_CONFIG_H
11
# include <config.h>
12
#endif
13
14
#define DISABLE_DEBUGLOG
15
16
17
#include "
o_word_l.h
"
18
#include "
htmlctx_l.h
"
19
20
#include <gwenhywfar/debug.h>
21
22
23
24
static
int
HtmlObject_Word_Layout
(
HTML_OBJECT
*o) {
25
const
char
*s;
26
int
w=0;
27
int
h=0;
28
29
s=
HtmlObject_GetText
(o);
30
if
(s) {
31
HTML_PROPS
*pr;
32
HTML_FONT
*fnt;
33
34
pr=
HtmlObject_GetProperties
(o);
35
assert(pr);
36
fnt=
HtmlProps_GetFont
(pr);
37
w=
HtmlCtx_GetTextWidth
(
HtmlObject_GetXmlCtx
(o), fnt, s)+(
HtmlFont_GetFontSize
(fnt)/2);
38
h=
HtmlCtx_GetTextHeight
(
HtmlObject_GetXmlCtx
(o), fnt, s);
39
}
40
41
HtmlObject_SetWidth
(o, w);
42
HtmlObject_SetHeight
(o, h);
43
return
0;
44
}
45
46
47
48
HTML_OBJECT
*
HtmlObject_Word_new
(
GWEN_XML_CONTEXT
*ctx,
const
char
*s) {
49
HTML_OBJECT
*o;
50
51
o=
HtmlObject_new
(ctx,
HtmlObjectType_Word
);
52
HtmlObject_SetText
(o, s);
53
HtmlObject_SetLayoutFn
(o,
HtmlObject_Word_Layout
);
54
55
return
o;
56
}
57
58
Generated on Wed Aug 21 2013 18:32:10 for gwenhywfar by
1.8.4