1
# Xlib.xobject.fontable -- fontable objects (GC, font)
3
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
from Xlib.protocol import request
24
class Fontable(resource.Resource):
25
__fontable__ = resource.Resource.__resource__
28
return request.QueryFont(display = self.display,
31
def query_text_extents(self, string):
32
return request.QueryTextExtents(display = self.display,
38
__gc__ = resource.Resource.__resource__
40
def change(self, onerror = None, **keys):
41
request.ChangeGC(display = self.display,
47
def copy(self, src_gc, mask, onerror = None):
48
request.CopyGC(display = self.display,
54
def set_dashes(self, offset, dashes, onerror = None):
55
request.SetDashes(display = self.display,
61
def set_clip_rectangles(self, x_origin, y_origin, rectangles, ordering, onerror = None):
62
request.SetClipRectangles(display = self.display,
68
rectangles = rectangles)
69
def free(self, onerror = None):
70
request.FreeGC(display = self.display,
74
self.display.free_resource_id(self.id)
79
__font__ = resource.Resource.__resource__
81
def close(self, onerror = None):
82
request.CloseFont(display = self.display,
85
self.display.free_resource_id(self.id)
87
def create_glyph_cursor(self, mask, source_char, mask_char,
88
(fore_red, fore_green, fore_blue),
89
(back_red, back_green, back_blue)):
91
cid = self.display.allocate_resource_id()
92
request.CreateGlyphCursor(display = self.display,
96
source_char = source_char,
97
mask_char = mask_char,
99
fore_green = fore_green,
100
fore_blue = fore_blue,
102
back_green = back_green,
103
back_blue = back_blue)
105
cls = self.display.get_resource_class('cursor', cursor.Cursor)
106
return cls(self.display, cid, owner = 1)