dabo Commit
Revision 4453
Date: 2008-08-26 10:53:36 -0700 (Tue, 26 Aug 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4453

Changed:
U   trunk/dabo/ui/uiwx/dFont.py

Log:
[4385] makes fonts on Mac smaller instead of scaling up in my app. This fixes 
it, but I'm not sure why we were testing for abs(float(val) - 
float(self._macNonScaledSize)) < .1. It seems to me we'd want to test for the 
difference of int(val) and the non scaled size being *greater*, not less than 
something like .001. But taking it out completely works for me.

Diff:
Modified: trunk/dabo/ui/uiwx/dFont.py
===================================================================
--- trunk/dabo/ui/uiwx/dFont.py 2008-08-26 16:55:14 UTC (rev 4452)
+++ trunk/dabo/ui/uiwx/dFont.py 2008-08-26 17:53:36 UTC (rev 4453)
@@ -110,25 +110,19 @@
                if not ret:
                        # Could be zero if it is the first time referenced when 
using Mac font scaling
                        if self._nativeFont:
-                               return self._nativeFont.GetPointSize()
+                               ret = self._nativeFont.GetPointSize()
                        else:
                                # No native font yet; return a reasonable 
default.
-                               return 9
-               else:   
-                       return ret
+                               ret = 9
+               return ret
 
        def _setSize(self, val):
-               try:
-                       val = int(val)
-               except ValueError:
-                       # Could be fractional. Try casting to float. If that 
fails,
-                       # let the ValueError be raised.
+               if int(val) != val:
+                       # cast to float
                        val = float(val)
                if self._useMacFontScaling():
-                       # Make sure that the difference is less than float 
rounding errors.
-                       if abs(float(val) - float(self._macNonScaledSize)) < 
0.1:
-                               self._macNonScaledSize = val
-                               val = round(val/.75, 0)
+                       self._macNonScaledSize = val
+                       val = round(val/.75, 0)
                try:
                        self._nativeFont.SetPointSize(val)
                except ValueError:




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to