diff --git a/gb.sdl/src/Cfont.cpp b/gb.sdl/src/Cfont.cpp index bd750c066..c6f56a3e0 100644 --- a/gb.sdl/src/Cfont.cpp +++ b/gb.sdl/src/Cfont.cpp @@ -145,7 +145,7 @@ BEGIN_PROPERTY(CFONT_italic) FONT->SetFontItalic(VPROP(GB_BOOLEAN)); END_PROPERTY - +/* BEGIN_PROPERTY(CFONT_strikeout) if (READ_PROPERTY) @@ -154,7 +154,7 @@ BEGIN_PROPERTY(CFONT_strikeout) FONT->SetFontStrikeout(VPROP(GB_BOOLEAN)); END_PROPERTY - +*/ BEGIN_PROPERTY(CFONT_underline) if (READ_PROPERTY) @@ -212,7 +212,7 @@ GB_DESC CFont[] = GB_PROPERTY("Size", "i", CFONT_size), GB_PROPERTY("Bold", "b", CFONT_bold), GB_PROPERTY("Italic", "b", CFONT_italic), - GB_PROPERTY("StrikeOut", "b", CFONT_strikeout), +// GB_PROPERTY("StrikeOut", "b", CFONT_strikeout), GB_PROPERTY("Underline", "b", CFONT_underline), GB_PROPERTY_READ("Ascent", "i", CFONT_ascent), diff --git a/gb.sdl/src/SDLcursor.cpp b/gb.sdl/src/SDLcursor.cpp index bb3e5f09a..1b9aa4557 100644 --- a/gb.sdl/src/SDLcursor.cpp +++ b/gb.sdl/src/SDLcursor.cpp @@ -73,14 +73,14 @@ void SDLcursor::Show(Window w) if (shape == SDL::DefaultCursor) shape = SDL::ArrowCursor; - SDLapp->LockX11(); + SDLapp->LockX11(); if (shape != SDL::CustomCursor) cursor = XcursorShapeLoadCursor(myDisplay, shape); else cursor = XcursorImageLoadCursor(myDisplay, hImgCursor); XDefineCursor(myDisplay, w, cursor); - SDLapp->UnlockX11(); + SDLapp->UnlockX11(); } diff --git a/gb.sdl/src/SDLerror.h b/gb.sdl/src/SDLerror.h index dc8b0529b..bb1f3adba 100644 --- a/gb.sdl/src/SDLerror.h +++ b/gb.sdl/src/SDLerror.h @@ -25,9 +25,9 @@ #include -#define COMP_WARN "gb.sdl warning: ", -#define COMP_ERR "gb.sdl error: ", -#define COMP_INFO "gb.sdl info: ", +#define COMP_WARN "gb.sdl warning: &1", +#define COMP_ERR "gb.sdl error: &1", +#define COMP_INFO "gb.sdl info: &1", class SDLerror { diff --git a/gb.sdl/src/SDLfont.cpp b/gb.sdl/src/SDLfont.cpp index 3fa87e088..566498de8 100644 --- a/gb.sdl/src/SDLfont.cpp +++ b/gb.sdl/src/SDLfont.cpp @@ -30,9 +30,11 @@ #include #include +/* #ifndef TTF_STYLE_STRIKETHROUGH #define TTF_STYLE_STRIKETHROUGH 0x08 #endif +*/ typedef struct { std::string name; @@ -44,7 +46,7 @@ typedef struct { static std::vector fontDB; static StringList _FontList; -#define DEFAULT_FONT_SIZE 20 +#define DEFAULT_FONT_SIZE 25 #define DEFAULT_DPI 72 /* Default DPI size in SDL_TTF */ inline bool cmp_db_nocase(const fontdesc x, const fontdesc y) @@ -142,12 +144,10 @@ SDLfont::SDLfont() hfonttype = X_font; hfontsize = DEFAULT_FONT_SIZE; hfontindex = 0; + hSDLfont = 0; hfontname = fontDB[hfontindex].path; - hSDLfont = TTF_OpenFont(hfontname.c_str(), hfontsize); - - if (UNLIKELY(hSDLfont == NULL)) - SDLerror::RaiseError(TTF_GetError()); + OpenFont(hfontname.c_str()); } SDLfont::SDLfont(char *fontfile) @@ -155,11 +155,9 @@ SDLfont::SDLfont(char *fontfile) hfonttype = SDLTTF_font; hfontsize = DEFAULT_FONT_SIZE; hfontname = fontfile; + hSDLfont = 0; - hSDLfont = TTF_OpenFont(fontfile, hfontsize); - - if (UNLIKELY(hSDLfont == NULL)) - SDLerror::RaiseError(TTF_GetError()); + OpenFont(fontfile); } SDLfont::~SDLfont() @@ -168,8 +166,34 @@ SDLfont::~SDLfont() TTF_CloseFont(hSDLfont); } +void SDLfont::OpenFont(const char* file) +{ + if (hSDLfont) + TTF_CloseFont(hSDLfont); + + hSDLfont = TTF_OpenFont(file, hfontsize); + + if (UNLIKELY(hSDLfont == NULL)) + SDLerror::RaiseError(TTF_GetError()); +} void SDLfont::SetFontName(char* name) { + std::string font = name; + int i=0; + + while (i