Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics/font.py
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-02-15 17:48:58 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-02-15 17:48:58 (GMT)
commit2e8bd12f8bcf9da314d853078ee29f35a381c537 (patch)
tree3f0922b2484b1a3d9194919fccdb69b5bee587a6 /sugar/graphics/font.py
parent32c89a1fcb7a536455343b87dc799b800da66380 (diff)
Rework color and fonts to be more pytonish. Add units conversions.
Diffstat (limited to 'sugar/graphics/font.py')
-rw-r--r--sugar/graphics/font.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/sugar/graphics/font.py b/sugar/graphics/font.py
new file mode 100644
index 0000000..023dc37
--- /dev/null
+++ b/sugar/graphics/font.py
@@ -0,0 +1,23 @@
+import pango
+
+from sugar.graphics import units
+
+_system_fonts = {
+ 'default' : 'Bitstream Vera Sans %d' % units.points_to_pixels(9)
+}
+
+class Font(object):
+ def __init__(self, desc):
+ self._desc = desc
+
+ def get_desc(self):
+ return self._desc
+
+ def get_pango_desc(self):
+ return pango.FontDescription(self._desc)
+
+class SystemFont(Font):
+ def __init__(self, font_id):
+ Font.__init__(self, _system_fonts[font_id])
+
+DEFAULT = SystemFont('default')