diff --git a/kivy/core/text/text_sdlttf.pyx b/kivy/core/text/text_sdlttf.pyx index 08864b102..0590fd93f 100644 --- a/kivy/core/text/text_sdlttf.pyx +++ b/kivy/core/text/text_sdlttf.pyx @@ -98,7 +98,7 @@ cdef TTF_Font *_get_font(self): fontid = self._get_font_id() if fontid not in pygame_cache: # try first the file if it's a filename - fontname = self.options['font_name'] + fontname = self.options['font_name_r'] ext = fontname.split('.')[-1] if ext.lower() == 'ttf': fontobject = TTF_OpenFont(fontname, @@ -127,7 +127,7 @@ class LabelSDLttf(LabelBase): def _get_font_id(self): return '|'.join([unicode(self.options[x]) for x \ - in ('font_size', 'font_name', 'bold', 'italic')]) + in ('font_size', 'font_name_r', 'bold', 'italic')]) def get_extents(self, text): try: @@ -136,6 +136,8 @@ class LabelSDLttf(LabelBase): pass cdef TTF_Font *font = _get_font(self) cdef int w, h + if font == NULL: + return 0, 0 TTF_SizeUTF8(font, text, &w, &h) return w, h @@ -160,6 +162,8 @@ class LabelSDLttf(LabelBase): cdef _SurfaceContainer sc = self._surface cdef SDL_Surface *st cdef SDL_Rect r + if font == NULL: + return c.r = c.g = c.b = 255 st = TTF_RenderUTF8_Blended(font, text, c) if st == NULL: diff --git a/kivy/core/window/sdl.pyx b/kivy/core/window/sdl.pyx index 8f7b3cb43..ae231a499 100644 --- a/kivy/core/window/sdl.pyx +++ b/kivy/core/window/sdl.pyx @@ -45,9 +45,6 @@ cdef extern from "SDL.h": long touchId long fingerId unsigned char state - unsigned char padding1 - unsigned char padding2 - unsigned char padding3 unsigned short x unsigned short y short dx @@ -129,7 +126,7 @@ cdef extern from "SDL.h": void SDL_GL_SwapBuffers() int SDL_GL_MakeCurrent(SDL_Window* window, SDL_GLContext context) - int SDL_GL_SetSwapInterval(int) + #int SDL_GL_SetSwapInterval(int) int SDL_Flip(SDL_Surface *) SDL_Surface *SDL_GetWindowSurface(SDL_Window *) SDL_GLContext SDL_GL_CreateContext(SDL_Window *) @@ -200,11 +197,11 @@ def setup_window(width, height, use_fake, use_fullscreen): SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); - SDL_GL_SetSwapInterval(1); + #SDL_GL_SetSwapInterval(1); ctx = SDL_GL_CreateContext(win) assert ctx != NULL - SDL_GL_SetSwapInterval(1); + #SDL_GL_SetSwapInterval(1); #surface = SDL_GetWindowSurface(win) cdef SDL_DisplayMode mode SDL_GetWindowDisplayMode(win, &mode) @@ -218,7 +215,6 @@ def resize_window(w, h): mode.h = h SDL_SetWindowDisplayMode(win, &mode) SDL_GetWindowDisplayMode(win, &mode) - print 'SDL resized window size to', mode.w, mode.h def set_window_title(str title):