Doug, let me try to ask you all the questions you're probably going to get all at once. :-)
Is this with the latest version of pyglet from the repository? What OS are you using? What file were you working on specifically? Did you look at the code/implementation for other operating systems? Will you submit your patch so that others can take a look at it? ...and remind you that cross-platform development IS really tricky and arduous, and no one is being paid to do this. I'm sure the committers would be happy to accept quality patches from you. :-) Font stuff is especially nasty. I spent several hours looking over some of the font implementation recently, and there are quite a few comments detailing the pain and agony the author(s) experienced with this or that platform. ~ Nathan On Mon, May 6, 2013 at 6:58 PM, Doug Linder <[email protected]>wrote: > -_____- > > Anyway, as a work around for this craziness, see here: > > http://www.starrhorne.com/2012/01/18/how-to-extract-font-names-from-ttf-files-using-python-and-our-old-friend-the-command-line.html > > I've manually patched my copy of pyglet so: > 1) have_font() does what it is supposed to and checks if the font exists > 2) a new font_name() function that returns the font name for a given ttf / > otf, etc. > > It pulls a dependency in on fontTools ( > http://sourceforge.net/projects/fonttools/) so it's probably no good for > a mainline merge, but something along these lines would make the pyglet > font for working with font files a great deal easier to use. > > ~ > Doug. > > > On Monday, May 6, 2013 8:29:44 PM UTC+8, Doug Linder wrote: >> >> Hey there, >> >> I'm having a lot of trouble with the font api. >> >> Basically it comes down to this: >> >> 1) If you have a font, and you call add_file() on it, you have no idea >> what the associated font name is. >> >> 2) If you call either pyglet.font.load() for pyglet.font.base.Font.have_* >> *font(), these return a font / true in all circumstances. >> >> The only way I've found to determine if we're successfully using a font >> or not is: >> >> pyglet.font.add_file(path) >> font = pyglet.font.load(name=font_**name, size=1) >> span = font.ascent + font.descent >> if span > 5: >> print("ID %s did not match a known font name" % self.font) >> >> This seems absolutely ridiculous to me. >> >> I mean, what the heck is this nonsense? >> >> @classmethod >> def have_font(cls, name): >> '''Determine if a font with the given name is installed. >> >> :Parameters: >> `name` : str >> Name of a font to search for >> >> :rtype: bool >> ''' >> return True >> >> !!! Why does the call even exist? >> >> I appreciate loading fonts cross platform is tricky, and I suppose it's >> vaguely nice having access to the default system fonts, but this api is >> really really hard to use. >> >> >> Am I doing something wrong? >> Why is using fonts so difficult? >> >> ~ >> Doug. >> > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pyglet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyglet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
