From 81decb42daaa590bbbb4481e987175221d070439 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 4 Jun 2009 06:35:44 +0000 Subject: [PATCH] Fixed calendar related font metrics for 3.x. --- Library.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Library.mm b/Library.mm index 35500a9..914d49a 100644 --- a/Library.mm +++ b/Library.mm @@ -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(dlsym(RTLD_DEFAULT, "GSFontGetUseLegacyFontMetrics")); + struct nlist nl[8]; memset(nl, 0, sizeof(nl)); -- 2.45.2