changeset 32:d2dbc90035ab

Removed enso.ui.graphics.getTextSize(), as it does not seem to be used anywhere.
author Atul Varma <varmaa@toolness.com>
date Sun, 24 Feb 2008 12:03:08 -0600
parents 5e4c680f49a3
children 605d8cb2728c
files enso/ui/graphics.py
diffstat 1 files changed, 0 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/enso/ui/graphics.py	Sun Feb 24 11:37:55 2008 -0600
+++ b/enso/ui/graphics.py	Sun Feb 24 12:03:08 2008 -0600
@@ -40,7 +40,6 @@
 # Imports
 # ----------------------------------------------------------------------------
 
-import cairo
 from enso.graphics.transparentwindow import TransparentWindow
 from enso.graphics.measurement import convertUserSpaceToPoints
 
@@ -114,33 +113,3 @@
     else:
         context.line_to( xPos+width, yPos )
     context.line_to( xPos+width, yPos+height-CORNER_RADIUS )
-
-
-
-def getTextSize( text, fontDict ):
-    """
-    Given a string of text and a fontDict containing the key "size",
-    returns the computed (width, height) of the corresponding rendered
-    text.
-    """
-    
-    global _emptyContext
-    if not _emptyContext:
-        wind = TransparentWindow( 0,0,1,1 )
-        _emptyContext = cairo.Context( wind.makeCairoSurface() )
-        convertUserSpaceToPoints( _emptyContext )
-
-    _emptyContext.select_font_face( fontDict["font"],
-                                 cairo.FONT_SLANT_NORMAL,
-                                 cairo.FONT_WEIGHT_NORMAL)
-    _emptyContext.set_font_size( fontDict["size"] )
-
-    ( xBearing,
-      yBearing,
-      width,
-      height,
-      xAdvance,
-      yAdvance ) = _emptyContext.text_extents( unicode(text).encode("UTF-8") )
-
-    # Invert the sign of yBearing, because Cairo works in screen coords.
-    return width,-yBearing