This commit is contained in:
Kovid Goyal 2008-12-16 16:29:56 -08:00
commit 28bd991b79
3 changed files with 10 additions and 6 deletions

View File

@ -111,9 +111,12 @@ class FcValue(Structure):
('u', _FcValue) ('u', _FcValue)
] ]
class FcObjectSet(Structure): pass
lib = load_library() lib = load_library()
lib.FcPatternBuild.restype = POINTER(FcPattern)
lib.FcPatternCreate.restype = c_void_p lib.FcPatternCreate.restype = c_void_p
lib.FcObjectSetCreate.restype = c_void_p lib.FcObjectSetCreate.restype = POINTER(FcObjectSet)
lib.FcFontSetDestroy.argtypes = [POINTER(FcFontSet)] lib.FcFontSetDestroy.argtypes = [POINTER(FcFontSet)]
lib.FcFontList.restype = POINTER(FcFontSet) lib.FcFontList.restype = POINTER(FcFontSet)
lib.FcNameUnparse.argtypes = [POINTER(FcPattern)] lib.FcNameUnparse.argtypes = [POINTER(FcPattern)]
@ -238,7 +241,7 @@ def files_for_family(family, normalize=True):
join() join()
if isinstance(family, unicode): if isinstance(family, unicode):
family = family.encode(preferred_encoding) family = family.encode(preferred_encoding)
family_pattern = lib.FcPatternBuild(0, 'family', FcTypeString, family, 0) family_pattern = lib.FcPatternBuild(0, 'family', FcTypeString, family, None)
if not family_pattern: if not family_pattern:
raise RuntimeError('Allocation failure') raise RuntimeError('Allocation failure')
#lib.FcPatternPrint(family_pattern) #lib.FcPatternPrint(family_pattern)
@ -256,8 +259,8 @@ def files_for_family(family, normalize=True):
fonts = {} fonts = {}
fs = lib.FcFontList(0, family_pattern, oset) fs = lib.FcFontList(0, family_pattern, oset)
font_set = fs.contents font_set = fs.contents
file = pointer(create_string_buffer(chr(0), 5000)) file = pointer(create_string_buffer(5000))
full_name = pointer(create_string_buffer(chr(0), 200)) full_name = pointer(create_string_buffer(200))
weight = c_int(0) weight = c_int(0)
slant = c_int(0) slant = c_int(0)
fname = '' fname = ''

View File

@ -175,7 +175,7 @@ mark_frame(void *context, uint32_t uncomp, uint32_t comp)
PyObject *rtable = self->rtable; PyObject *rtable = self->rtable;
PyObject *entry = NULL; PyObject *entry = NULL;
entry = Py_BuildValue("(LL)", uncomp, comp); entry = Py_BuildValue("(II)", uncomp, comp);
if (entry) { if (entry) {
PyList_Append(rtable, entry); PyList_Append(rtable, entry);
Py_DECREF(entry); Py_DECREF(entry);

View File

@ -789,6 +789,7 @@ class BasicNewsRecipe(object, LoggingInterface):
html= u'''\ html= u'''\
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css"> <style type="text/css">
body { body {
background: white no-repeat fixed center center; background: white no-repeat fixed center center;
@ -824,7 +825,7 @@ class BasicNewsRecipe(object, LoggingInterface):
app=__appname__ +' '+__version__, app=__appname__ +' '+__version__,
img=img) img=img)
f2 = tempfile.NamedTemporaryFile(suffix='cover.html') f2 = tempfile.NamedTemporaryFile(suffix='cover.html')
f2.write(html) f2.write(html.encode('utf-8'))
f2.flush() f2.flush()
page = QWebPage() page = QWebPage()
pal = page.palette() pal = page.palette()