gwenhywfar  5.10.1
htmlfont.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 "htmlfont_p.h"
18 
19 
20 
23 
24 
26 {
27  HTML_FONT *fnt;
28 
30  fnt->refCount=1;
33 
34  return fnt;
35 }
36 
37 
38 
40 {
41  if (fnt) {
42  assert(fnt->refCount);
43  if (fnt->refCount>1)
44  fnt->refCount--;
45  else {
48  free(fnt->fontName);
49 
50  fnt->refCount=0;
51  GWEN_FREE_OBJECT(fnt);
52  }
53  }
54 }
55 
56 
57 
59 {
60  assert(fnt);
61  assert(fnt->refCount);
62  fnt->refCount++;
63 }
64 
65 
66 
67 const char *HtmlFont_GetFontName(const HTML_FONT *fnt)
68 {
69  assert(fnt);
70  assert(fnt->refCount);
71  return fnt->fontName;
72 }
73 
74 
75 
76 void HtmlFont_SetFontName(HTML_FONT *fnt, const char *s)
77 {
78  assert(fnt);
79  assert(fnt->refCount);
80  free(fnt->fontName);
81  if (s)
82  fnt->fontName=strdup(s);
83  else
84  fnt->fontName=NULL;
85 }
86 
87 
88 
90 {
91  assert(fnt);
92  assert(fnt->refCount);
93  return fnt->fontSize;
94 }
95 
96 
97 
99 {
100  assert(fnt);
101  assert(fnt->refCount);
102  fnt->fontSize=i;
103 }
104 
105 
106 
107 uint32_t HtmlFont_GetFontFlags(const HTML_FONT *fnt)
108 {
109  assert(fnt);
110  assert(fnt->refCount);
111  return fnt->fontFlags;
112 }
113 
114 
115 
116 void HtmlFont_SetFontFlags(HTML_FONT *fnt, uint32_t i)
117 {
118  assert(fnt);
119  assert(fnt->refCount);
120  fnt->fontFlags=i;
121 }
122 
123 
124 
125 void HtmlFont_AddFontFlags(HTML_FONT *fnt, uint32_t i)
126 {
127  assert(fnt);
128  assert(fnt->refCount);
129  fnt->fontFlags|=i;
130 }
131 
132 
133 
134 void HtmlFont_SubFontFlags(HTML_FONT *fnt, uint32_t i)
135 {
136  assert(fnt);
137  assert(fnt->refCount);
138  fnt->fontFlags&=~i;
139 }
140 
141 
142 
143 
void HtmlFont_SubFontFlags(HTML_FONT *fnt, uint32_t i)
Definition: htmlfont.c:134
const char * HtmlFont_GetFontName(const HTML_FONT *fnt)
Definition: htmlfont.c:67
void HtmlFont_Attach(HTML_FONT *fnt)
Definition: htmlfont.c:58
int HtmlFont_GetFontSize(const HTML_FONT *fnt)
Definition: htmlfont.c:89
#define GWEN_INHERIT_FINI(t, element)
Definition: inherit.h:238
void HtmlFont_SetFontSize(HTML_FONT *fnt, int i)
Definition: htmlfont.c:98
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define NULL
Definition: binreloc.c:300
void HtmlFont_free(HTML_FONT *fnt)
Definition: htmlfont.c:39
HTML_FONT * HtmlFont_new(void)
Definition: htmlfont.c:25
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
struct HTML_FONT HTML_FONT
Definition: htmlfont_be.h:23
#define GWEN_INHERIT_INIT(t, element)
Definition: inherit.h:223
#define GWEN_LIST_INIT(t, element)
Definition: list1.h:465
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition: list1.h:366
void HtmlFont_SetFontFlags(HTML_FONT *fnt, uint32_t i)
Definition: htmlfont.c:116
void HtmlFont_SetFontName(HTML_FONT *fnt, const char *s)
Definition: htmlfont.c:76
uint32_t HtmlFont_GetFontFlags(const HTML_FONT *fnt)
Definition: htmlfont.c:107
#define GWEN_LIST_FINI(t, element)
Definition: list1.h:474
#define GWEN_INHERIT_FUNCTIONS(t)
Definition: inherit.h:163
void HtmlFont_AddFontFlags(HTML_FONT *fnt, uint32_t i)
Definition: htmlfont.c:125