-
Notifications
You must be signed in to change notification settings - Fork 1
/
font.py
70 lines (56 loc) · 1.57 KB
/
font.py
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
#!/usr/bin/python
import pygtk
import gtk
import cairo
class Font(object):
""" A simple class used to define the fonts within the framwork for the visualisation of the single components. """
def __init__(self):
""" Constructor of Font. """
# set default values
self._font = "Courier New"
self._size = 11
self._weight = cairo.FONT_SLANT_NORMAL
self._slant = cairo.FONT_WEIGHT_NORMAL
@property
def font(self):
""" Return font type. """
return self._font
@property
def size(self):
""" Return font size. """
return self._size
@property
def weight(self):
""" Return font weight. """
return self._weight
@property
def slant(self):
""" Return font slant. """
return self._slant
@font.setter
def font(self, font):
""" Set font type. """
self._font = font
@size.setter
def size(self, size):
""" Set font size. """
self._size = size
@weight.setter
def weight(self, weight = cairo.FONT_WEIGHT_NORMAL):
""" Set font weight. """
self._weight = weight
@slant.setter
def slant(self, slant = cairo.FONT_SLANT_NORMAL):
""" Set font slant. """
self._slant = slant
def clone(self):
""" Duplicate the current font and return it. """
# duplicate
f = Font()
# set properties
f.font = self.font
f.size = self.size
f.weight = self.weight
f.slant = self.slant
# return duplicate
return f