8000 SC 2005/03/07 · matplotlib/matplotlib@37e1c91 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit 37e1c91

Browse files
author
Steve Chaplin
committed
SC 2005/03/07
svn path=/trunk/matplotlib/; revision=1046
1 parent 73bd926 commit 37e1c91

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
New entries should be added at the top
22

3+
2005-03-07 backend_gdk.py: remove PIXELS_PER_INCH from points_to_pixels(), but
4+
still use it to adjust font sizes. This allows the GTK version of
5+
line_styles.py to more closely match GTKAgg, previously the markers
6+
were being drawn too large. - SC
7+
38
2005-03-01 Added Eric's contourf routines
49

510
2005-03-01 Added start of proper agg SWIG wrapper. I would like to

lib/matplotlib/backends/backend_gdk.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def fn_name(): return sys._getframe(1).f_code.co_name
2828
raise SystemExit('PyGTK version %d.%d.%d or greater is required to run the GTK Matplotlib backends'
2929
% pygtk_version_required)
3030

31-
#import gobject
3231
import gtk, pango
3332
from gtk import gdk
3433
if gtk.pygtk_version < pygtk_version_required:
@@ -43,7 +42,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
4342

4443
# the true dots per inch on the screen; should be display dependent
4544
# see http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5 for some info about screen dpi
46-
PIXELS_PER_INCH = 96
45+
#PIXELS_PER_INCH = 96
4746

4847
# Image formats that this backend supports - for FileChooser and print_figure()
4948
IMAGE_FORMAT = ['eps', 'jpg', 'png', 'ps', 'svg'] + ['bmp'] # , 'raw', 'rgb']
@@ -318,6 +317,9 @@ def _get_pango_layout(self, s, prop):
318317
"""
319318
Create a pango layout instance for Text 's' with properties 'prop'.
320319
Return - pango layout (from cache if already exists)
320+
321+
Note that pango assumes a logical DPI of 96
322+
Ref: pango_font_description_set_size() manual page
321323
"""
322324
# problem? - cache gets bigger and bigger, is never cleared out
323325
# two (not one) layouts are created for every text item s (then they are cached) - why?
@@ -327,7 +329,8 @@ def _get_pango_layout(self, s, prop):
327329
if value != None:
328330
return value
329331

330-
size = prop.get_size_in_points() * self.dpi.get() / PIXELS_PER_INCH
332+
#size = prop.get_size_in_points() * self.dpi.get() / PIXELS_PER_INCH
333+
size = prop.get_size_in_points() * self.dpi.get() / 96.0
331334
size = round(size)
332335

333336
font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,)
@@ -365,7 +368,8 @@ def new_gc(self):
365368

366369

367370
def points_to_pixels(self, points):
368-
return points * PIXELS_PER_INCH/72.0 * self.dpi.get()/72.0
371+
#return points * PIXELS_PER_INCH/72.0 * self.dpi.get()/72.0
372+
return points/72.0 * self.dpi.get()
369373

370374

371375
class GraphicsContextGDK(GraphicsContextBase):

lib/matplotlib/backends/backend_template.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ def flipy(self):
9090

9191
def points_to_pixels(self, points):
9292
"""
93-
Convert points to display units (as a float).
94-
You need to override this function (unless your backend doesn't have
95-
dpi, eg, postscript or svg).
96-
Many imaging systems assume some value for pixels per inch.
97-
points to pixels = points * pixels_per_inch/72.0 * dpi/72.0
93+
Convert points to pixels (display units) as a float.
9894
"""
99-
return points
95+
# if backend doesn't have dpi, eg, postscript or svg
96+
return points
97+
# elif backend assumes a value for pixels_per_inch
98+
#return points/72.0 * self.dpi.get() * pixels_per_inch/72.0
99+
# else
100+
#return points/72.0 * self.dpi.get()
100101

101102
def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
102103
"""

0 commit comments

Comments
 (0)
0