aboutsummaryrefslogtreecommitdiff
path: root/src/Font.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Font.cc')
-rw-r--r--src/Font.cc29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/Font.cc b/src/Font.cc
index cfd7303..2430950 100644
--- a/src/Font.cc
+++ b/src/Font.cc
@@ -19,20 +19,29 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22//$Id: Font.cc,v 1.2 2002/03/21 11:05:41 fluxgen Exp $ 22//$Id: Font.cc,v 1.3 2002/03/27 15:37:19 fluxgen Exp $
23
24
23#include "Font.hh" 25#include "Font.hh"
24#include <cstdarg>
25#include <iostream> //for debug msg
26using namespace std;
27 26
27#include "StringUtil.hh"
28//use gnu extensions 28//use gnu extensions
29#ifndef _GNU_SOURCE 29#ifndef _GNU_SOURCE
30#define _GNU_SOURCE 30#define _GNU_SOURCE
31#endif //_GNU_SOURCE 31#endif //_GNU_SOURCE
32 32
33#include <cstdarg>
34#include <iostream>
35#include <cassert>
36#include <string>
37#include <cstdio>
38
33#ifdef HAVE_CONFIG_H 39#ifdef HAVE_CONFIG_H
34# include "../config.h" 40# include "../config.h"
35#endif // HAVE_CONFIG_H 41#endif // HAVE_CONFIG_H
42#ifdef HAVE_SETLOCALE
43#include <locale.h>
44#endif //HAVE_SETLOCALE
36 45
37namespace FbTk 46namespace FbTk
38{ 47{
@@ -133,7 +142,7 @@ XFontSet Font::createFontSet(Display *display, const char *fontname) {
133 fontname, &missing, &nmissing, &def); 142 fontname, &missing, &nmissing, &def);
134 if (fs && (! nmissing)) return fs; 143 if (fs && (! nmissing)) return fs;
135 144
136#ifdef HAVE_SETLOCALE 145#ifdef HAVE_SETLOCALE
137 if (! fs) { 146 if (! fs) {
138 if (nmissing) XFreeStringList(missing); 147 if (nmissing) XFreeStringList(missing);
139 148
@@ -158,9 +167,9 @@ XFontSet Font::createFontSet(Display *display, const char *fontname) {
158 getFontSize(fontname, &pixel_size); 167 getFontSize(fontname, &pixel_size);
159 168
160 if (! strcmp(weight, "*")) 169 if (! strcmp(weight, "*"))
161 strncpy(weight, "medium", FONT_ELEMENT_SIZE); 170 std::strncpy(weight, "medium", FONT_ELEMENT_SIZE);
162 if (! strcmp(slant, "*")) 171 if (! strcmp(slant, "*"))
163 strncpy(slant, "r", FONT_ELEMENT_SIZE); 172 std::strncpy(slant, "r", FONT_ELEMENT_SIZE);
164 if (pixel_size < 3) 173 if (pixel_size < 3)
165 pixel_size = 3; 174 pixel_size = 3;
166 else if (pixel_size > 97) 175 else if (pixel_size > 97)
@@ -196,9 +205,9 @@ const char *Font::getFontElement(const char *pattern, char *buf, int bufsiz, ...
196 buf[bufsiz-1] = 0; 205 buf[bufsiz-1] = 0;
197 buf[bufsiz-2] = '*'; 206 buf[bufsiz-2] = '*';
198 while((v = va_arg(va, char *)) != NULL) { 207 while((v = va_arg(va, char *)) != NULL) {
199 p = strcasestr(pattern, v); 208 p = StringUtil::strcasestr(pattern, v);
200 if (p) { 209 if (p) {
201 strncpy(buf, p+1, bufsiz-2); 210 std::strncpy(buf, p+1, bufsiz-2);
202 p2 = strchr(buf, '-'); 211 p2 = strchr(buf, '-');
203 if (p2) *p2=0; 212 if (p2) *p2=0;
204 va_end(va); 213 va_end(va);
@@ -206,7 +215,7 @@ const char *Font::getFontElement(const char *pattern, char *buf, int bufsiz, ...
206 } 215 }
207 } 216 }
208 va_end(va); 217 va_end(va);
209 strncpy(buf, "*", bufsiz); 218 std::strncpy(buf, "*", bufsiz);
210 return NULL; 219 return NULL;
211} 220}
212 221