This commit is contained in:
Kovid Goyal 2012-10-02 13:41:29 +05:30
parent 5a4d164347
commit 1c7330d465
2 changed files with 5 additions and 3 deletions

View File

@ -26,7 +26,8 @@ class Fonts(object):
def files_for_family(self, family, normalize=True): def files_for_family(self, family, normalize=True):
''' '''
Find all the variants in the font family `family`. Find all the variants in the font family `family`.
Returns a dictionary of tuples. Each tuple is of the form (Full font name, path to font file). Returns a dictionary of tuples. Each tuple is of the form (path to font
file, Full font name).
The keys of the dictionary depend on `normalize`. If `normalize` is `False`, The keys of the dictionary depend on `normalize`. If `normalize` is `False`,
they are a tuple (slant, weight) otherwise they are strings from the set they are a tuple (slant, weight) otherwise they are strings from the set
`('normal', 'bold', 'italic', 'bi', 'light', 'li')` `('normal', 'bold', 'italic', 'bi', 'light', 'li')`
@ -40,7 +41,7 @@ class Fonts(object):
pt = PersistentTemporaryFile('.'+ext) pt = PersistentTemporaryFile('.'+ext)
pt.write(data) pt.write(data)
pt.close() pt.close()
ans[ft] = (name, pt.name) ans[ft] = (pt.name, name)
return ans return ans
return self.backend.files_for_family(family, normalize=normalize) return self.backend.files_for_family(family, normalize=normalize)

View File

@ -75,7 +75,8 @@ class FontConfig(Thread):
def files_for_family(self, family, normalize=True): def files_for_family(self, family, normalize=True):
''' '''
Find all the variants in the font family `family`. Find all the variants in the font family `family`.
Returns a dictionary of tuples. Each tuple is of the form (Full font name, path to font file). Returns a dictionary of tuples. Each tuple is of the form (path to font
file, Full font name).
The keys of the dictionary depend on `normalize`. If `normalize` is `False`, The keys of the dictionary depend on `normalize`. If `normalize` is `False`,
they are a tuple (slant, weight) otherwise they are strings from the set they are a tuple (slant, weight) otherwise they are strings from the set
`('normal', 'bold', 'italic', 'bi', 'light', 'li')` `('normal', 'bold', 'italic', 'bi', 'light', 'li')`