]> git.saurik.com Git - winterboard.git/commitdiff
Fixed calendar related font metrics for 3.x.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 4 Jun 2009 06:35:44 +0000 (06:35 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 4 Jun 2009 06:35:44 +0000 (06:35 +0000)
Library.mm

index 35500a90058d9fc6c1b5e95555bb4ee90171b0aa..914d49a47e9589998671d136c1c4d5ee14c4ee2e 100644 (file)
@@ -155,6 +155,10 @@ Class $SBWidgetApplicationIcon;
 
 @end
 
+static BOOL (*_GSFontGetUseLegacyFontMetrics)();
+#define $GSFontGetUseLegacyFontMetrics() \
+    (_GSFontGetUseLegacyFontMetrics == NULL ? YES : _GSFontGetUseLegacyFontMetrics())
+
 bool Debug_ = false;
 bool Engineer_ = false;
 
@@ -532,8 +536,10 @@ MSHook(void, SBCalendarIconContentsView$drawRect$, SBCalendarIconContentsView *s
     CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
     CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
 
+    unsigned base($GSFontGetUseLegacyFontMetrics() ? 71 : 70);
+
     [(NSString *)date drawAtPoint:CGPointMake(
-        (width + 1 - datesize.width) / 2, (71 - datesize.height) / 2
+        (width + 1 - datesize.width) / 2, (base - datesize.height) / 2
     ) withStyle:datestyle];
 
     [(NSString *)day drawAtPoint:CGPointMake(
@@ -1242,6 +1248,8 @@ extern "C" void WBInitialize() {
 
     NSLog(@"WB:Notice: WinterBoard");
 
+    _GSFontGetUseLegacyFontMetrics = reinterpret_cast<BOOL (*)()>(dlsym(RTLD_DEFAULT, "GSFontGetUseLegacyFontMetrics"));
+
     struct nlist nl[8];
     memset(nl, 0, sizeof(nl));