Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e74dab9

Browse files
author
Steve Chaplin
committed
SC 08/12/2004
svn path=/trunk/matplotlib/; revision=739
1 parent d99226e commit e74dab9

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

lib/matplotlib/backends/backend_gtk.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ class RendererGTK(RendererBase):
8888
'ultrabold' : pango.WEIGHT_ULTRABOLD,
8989
'black' : pango.WEIGHT_ULTRABOLD,
9090
}
91-
fontangles = {
92-
'italic' : pango.STYLE_ITALIC,
93-
'normal' : pango.STYLE_NORMAL,
94-
'oblique' : pango.STYLE_OBLIQUE,
95-
}
91+
#fontangles = {
92+
# 'italic' : pango.STYLE_ITALIC,
93+
# 'normal' : pango.STYLE_NORMAL,
94+
# 'oblique' : pango.STYLE_OBLIQUE,
95+
# }
9696

9797
# cache for efficiency, these must be at class, not instance level
9898
layoutd = {} # a map from text prop tups to pango layouts
99-
extentd = {} # a map from text prop tups to text extents
100-
offsetd = {} # a map from text prop tups to text offsets
99+
#extentd = {} # a map from text prop tups to text extents
100+
#offsetd = {} # a map from text prop tups to text offsets
101101
rotated = {} # a map from text prop tups to rotated text pixbufs
102102

103103
#def __init__(self, gtkDA, gdkDrawable, width, height, dpi):
@@ -347,16 +347,24 @@ def _get_pango_layout(self, s, prop):
347347
if layout is not None:
348348
return layout
349349

350-
fontname = prop.get_name()
351-
#if fontname.lower()=='times': fontname = "serif"
352-
353-
font = pango.FontDescription('%s' % fontname)
354-
355-
font.set_weight(self.fontweights[prop.get_weight()])
356-
font.set_style(self.fontangles[prop.get_style()])
350+
#fontname = prop.get_name()
351+
#font = pango.FontDescription('%s' % fontname)
352+
#font.set_weight(self.fontweights[prop.get_weight()])
353+
#font.set_style(self.fontangles[prop.get_style()])
354+
#size = prop.get_size_in_points() * self.dpi.get() / PIXELS_PER_INCH
355+
#font.set_size (int(size * 1024)) # pango.SCALE = 1024, not defined in pygtk 1.99.16
356+
#layout = self.gtkDA.create_pango_layout(s)
357+
#layout.set_font_description(font)
357358

358359
size = prop.get_size_in_points() * self.dpi.get() / PIXELS_PER_INCH
359-
font.set_size (int(size * 1024)) # pango.SCALE = 1024, not defined in pygtk 1.99.16
360+
size = round(size)
361+
362+
font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,)
363+
font = pango.FontDescription(font_str)
364+
365+
# later - add fontweight to font_str
366+
font.set_weight(self.fontweights[prop.get_weight()])
367+
360368
layout = self.gtkDA.create_pango_layout(s)
361369
layout.set_font_description(font)
362370

0 commit comments

Comments
 (0)