Indeed it seems more natural to pass the font object, so I think I will update the code to also allow that.
The reason you need to create the uMono object, is that it is a non system font, so pyglet needs to load it to be aware of it. If you do not keep the reference to it, pyglet may decide to unload it again. It cannot know whether you are planning to use it again. The name you use for it should be the same that would be displayed in the system. Unfortunately there is also no font name exposed in a platform independent way. I will do the following: I will create two improvement requests: 1 for allowing a font object instead of a string for name, 1 for exposing the font name. Rob Op vrijdag 21 augustus 2015 20:49:51 UTC+2 schreef Jesse Cox: > > I'm passing uMono. I didn't get the point of creating uMono if it wasn't > usable. Also, what do I call the string? The font is called Ubuntu Mono > Regular but in the system, it's called as Ubuntu Mono. One last question if > you don't mind, have any suggestions on lowering resource usage? I want it > to be as light as possible. > > On Friday, August 21, 2015 at 1:10:35 PM UTC-5, Rob wrote: >> >> In this case it is not a problem with the font, but a problem in code. >> Inside freetype.py it is expecting a string, but it is getting an instance >> of FreeTypeFont. That is causing this error. >> >> What are you passing to the text object you are creating? Do you pass >> uMono or the name of the font? Currently it must be the name of the font. >> (Passing the font itself is not a bad idea I must say). >> >> Rob >> >> Op vrijdag 21 augustus 2015 19:47:37 UTC+2 schreef Jesse Cox: >>> >>> 5, in get_font_runs >>> ft = self.get_font(dpi=dpi) >>> File "/usr/local/lib/python3.4/dist-packages/pyglet/text/document.py", >>> line 615, in get_font >>> bold=bool(bold), italic=bool(italic), dpi=dpi) >>> File "/usr/local/lib/python3.4/dist-packages/pyglet/font/__init__.py", >>> line 648, in load >>> font = _font_class(name, size, bold=bold, italic=italic, dpi=dpi) >>> File "/usr/local/lib/python3.4/dist-packages/pyglet/font/freetype.py", >>> line 247, in __init__ >>> self._set_face(self._load_font_face()) >>> File "/usr/local/lib/python3.4/dist-packages/pyglet/font/freetype.py", >>> line 272, in _load_font_face >>> memory_font = self._get_memory_font(self.name, self.bold, >>> self.italic) >>> File "/usr/local/lib/python3.4/dist-packages/pyglet/font/freetype.py", >>> line 359, in _get_memory_font >>> lname = name and name.lower() or '' >>> AttributeError: 'FreeTypeFont' object has no attribute 'lower' >>> >>> On Friday, August 21, 2015 at 9:58:40 AM UTC-5, Jason Spashett wrote: >>>> >>>> Can you give the error message you are getting? >>>> >>>> I can't run your example at the moment: TypeError: listdir() takes >>>> exactly 1 argument (0 given) >>>> >>>> On Friday, 21 August 2015 06:17:39 UTC+1, Jesse Cox wrote: >>>>> >>>>> I'm trying to distrubute the Ubuntu Mono font with a media player I'm >>>>> developing: https://github.com/ki4jgt/SIMP >>>>> >>>>> Whenever I try to use uMono on line 168 (defined on line 27), it >>>>> complains about missing lower cases or something. Is there any way I can >>>>> modify the file so that it is compatible with Pyglet? >>>>> >>>> -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.