freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] (copy) Freetype to Cairo - newb needs help


From: Donn
Subject: [ft-devel] (copy) Freetype to Cairo - newb needs help
Date: Mon, 22 Oct 2007 18:38:36 +0200
User-agent: KMail/1.9.1

(Copy of email sent to cairo list. It applies to FT too. Plus -- any 
suggestions about how to access FT using ctypes in Python would be good.)


Hello, 
 I am completely out of my depth here really. I have been hacking together the 
attached code for days. Everything about C/C++ bewilders me, but I make notes 
and I have a manual! 

I'm on Kubuntu Dapper Drake. I have source-installed the latest cairo, 
pycairo, pygtk -- all seems good.

Anyway, on to the issue:
1. I want to use pure python.
2. I want to use Cairo to draw strings of text to a surface.
3. I want to specify the file (or files) of what font I want it to use.

Number 3 in the list is the rub. I see there is 
a "cairo_ft_font_face_create_for_ft_face" function in the c/c++ API, but 
nothing like it in pycairo. I have searched around and it seems to be a grey 
area of controversy for lofty reasons I will never grasp.

So, like a fool, I thought, why not just extend Python with a module that will 
open font Blah with Freetype2, get the Cairo font whatsis from that and then 
pass it back up to Python! Yeah, right ...

My basic idea was to be able to say:
import cairo
import Foo
font = Foo.getfont("some/path/to/font.ttf")
cr = cairo.Context(self.surface)
cr.select_font_face(font, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD)
cr.set_font_face(font)
cr.set_font_size(0.5)
cr.etc( :) )

I want it to open Type1 fonts too, but that's another story, I don't yet know 
how Cairo handles those kinds of fonts.

I have attached the Makefile (which I cobbled-together randomly over a long 
period of time) too.

I hope someone can point me in the right direction.
/d


Attachment: foo.c
Description: Text Data

Attachment: Makefile
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]