/usr/lib/python3/dist-packages/Xlib/xobject/fontable.py is in python3-xlib 0.20-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | # Xlib.xobject.fontable -- fontable objects (GC, font)
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
from Xlib.protocol import request
from . import resource
from . import cursor
class Fontable(resource.Resource):
__fontable__ = resource.Resource.__resource__
def query(self):
return request.QueryFont(display = self.display,
font = self.id)
def query_text_extents(self, string):
return request.QueryTextExtents(display = self.display,
font = self.id,
string = string)
class GC(Fontable):
__gc__ = resource.Resource.__resource__
def change(self, onerror = None, **keys):
request.ChangeGC(display = self.display,
onerror = onerror,
gc = self.id,
attrs = keys)
def copy(self, src_gc, mask, onerror = None):
request.CopyGC(display = self.display,
onerror = onerror,
src_gc = src_gc,
dst_gc = self.id,
mask = mask)
def set_dashes(self, offset, dashes, onerror = None):
request.SetDashes(display = self.display,
onerror = onerror,
gc = self.id,
dash_offset = offset,
dashes = dashes)
def set_clip_rectangles(self, x_origin, y_origin, rectangles, ordering, onerror = None):
request.SetClipRectangles(display = self.display,
onerror = onerror,
ordering = ordering,
gc = self.id,
x_origin = x_origin,
y_origin = y_origin,
rectangles = rectangles)
def free(self, onerror = None):
request.FreeGC(display = self.display,
onerror = onerror,
gc = self.id)
self.display.free_resource_id(self.id)
class Font(Fontable):
__font__ = resource.Resource.__resource__
def close(self, onerror = None):
request.CloseFont(display = self.display,
onerror = onerror,
font = self.id)
self.display.free_resource_id(self.id)
def create_glyph_cursor(self, mask, source_char, mask_char,
foreground, background):
fore_red, fore_green, fore_blue = foreground
back_red, back_green, back_blue = background
cid = self.display.allocate_resource_id()
request.CreateGlyphCursor(display = self.display,
cid = cid,
source = self.id,
mask = mask,
source_char = source_char,
mask_char = mask_char,
fore_red = fore_red,
fore_green = fore_green,
fore_blue = fore_blue,
back_red = back_red,
back_green = back_green,
back_blue = back_blue)
cls = self.display.get_resource_class('cursor', cursor.Cursor)
return cls(self.display, cid, owner = 1)
|