diff --git a/doc/sources/installation/installation-windows.rst b/doc/sources/installation/installation-windows.rst index 31c38ed1a..0295f1501 100644 --- a/doc/sources/installation/installation-windows.rst +++ b/doc/sources/installation/installation-windows.rst @@ -25,8 +25,12 @@ Installing the portable version :scale: 75% #. In the folder where you unzipped the package, you have a script called `kivy.bat`. - Use this file for launching any kivy application as described below - + Use this file for launching any kivy application as described below. + + .. note:: + Launching the kivy.bat file will open a command window already set up to run kivy's + Python. The environment settings are only changed for this command window and will + not effect the system environment. .. _windows-run-app: diff --git a/kivy/core/text/text_pygame.py b/kivy/core/text/text_pygame.py index 0ec1394cf..363b690c8 100644 --- a/kivy/core/text/text_pygame.py +++ b/kivy/core/text/text_pygame.py @@ -14,6 +14,7 @@ except: raise pygame_cache = {} +pygame_font_handles = {} pygame_cache_order = [] # init pygame font @@ -40,12 +41,13 @@ class LabelPygame(LabelBase): fontid = self._get_font_id() if fontid not in pygame_cache: # try first the file if it's a filename - fontobject = None + font_handle = fontobject = None fontname = self.options['font_name_r'] ext = fontname.split('.')[-1] if ext.lower() == 'ttf': # fontobject - fontobject = pygame.font.Font(fontname, + font_handle = open(fontname, 'rb') + fontobject = pygame.font.Font(font_handle, int(self.options['font_size'])) # fallback to search a system font @@ -60,12 +62,16 @@ class LabelPygame(LabelBase): fontobject = pygame.font.Font(font, int(self.options['font_size'])) pygame_cache[fontid] = fontobject + pygame_font_handles[fontid] = font_handle pygame_cache_order.append(fontid) # to prevent too much file open, limit the number of opened fonts to 64 while len(pygame_cache_order) > 64: popid = pygame_cache_order.pop(0) del pygame_cache[popid] + font_handle = pygame_font_handles.pop(popid) + if font_handle is not None: + font_handle.close() return pygame_cache[fontid] diff --git a/kivy/tests/test_fonts.py b/kivy/tests/test_fonts.py index 53c06822b..700995f9c 100644 --- a/kivy/tests/test_fonts.py +++ b/kivy/tests/test_fonts.py @@ -6,7 +6,7 @@ class FontTestCase(unittest.TestCase): def setUp(self): import os - self.font_name = os.path.join(os.path.dirname(__file__), 'कीवी.ttf') + self.font_name = os.path.join(os.path.dirname(__file__), u'कीवी.ttf') if not os.path.exists(self.font_name): from zipfile import ZipFile with ZipFile(os.path.join(os.path.dirname(__file__),