From e4cbfc3e408cc38fb21d4c72ba0b1cff1d5d754b Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 9 Jan 2014 02:27:30 -0800 Subject: [PATCH] Witness the wonder of UIStringDrawingSuperCrufty. --- Library.mm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Library.mm b/Library.mm index b2ee645..b3eb56c 100644 --- a/Library.mm +++ b/Library.mm @@ -769,21 +769,23 @@ static NSString *WBColorMarkup() { return [NSString stringWithFormat:@"color: rgba(%g, %g, %g, %g)", r * 255, g * 255, b * 255, a]; } -MSInstanceMessageHook6(CGSize, NSString, drawAtPoint,forWidth,withFont,lineBreakMode,letterSpacing,includeEmoji, CGPoint, point, float, width, UIFont *, font, UILineBreakMode, mode, float, spacing, BOOL, emoji) { - //NSLog(@"XXX: @\"%@\" %g", self, spacing); +extern "C" NSString *NSStringFromCGPoint(CGPoint rect); + +MSInstanceMessageHook5(CGSize, NSString, drawAtPoint,forWidth,withFont,lineBreakMode,letterSpacing, CGPoint, point, CGFloat, width, UIFont *, font, UILineBreakMode, mode, CGFloat, spacing) { + //NSLog(@"XXX: @\"%@\" %@ %g \"%@\" %u %g", self, NSStringFromCGPoint(point), width, font, mode, spacing); WBStringDrawingState *state(stringDrawingState_); if (state == NULL) - return MSOldCall(point, width, font, mode, spacing, emoji); + return MSOldCall(point, width, font, mode, spacing); if (state->count_ != 0 && --state->count_ == 0) stringDrawingState_ = state->next_; if (state->info_ == nil) - return MSOldCall(point, width, font, mode, spacing, emoji); + return MSOldCall(point, width, font, mode, spacing); NSString *info([Info_ objectForKey:state->info_]); if (info == nil) - return MSOldCall(point, width, font, mode, spacing, emoji); + return MSOldCall(point, width, font, mode, spacing); NSString *base(state->base_ ?: @""); NSString *extra([NSString stringWithFormat:@"letter-spacing: %gpx", spacing]); @@ -794,7 +796,7 @@ MSInstanceMessageHook6(CGSize, NSString, drawAtPoint,forWidth,withFont,lineBreak extern "C" NSString *NSStringFromCGRect(CGRect rect); MSInstanceMessageHook7(CGSize, NSString, _drawInRect,withFont,lineBreakMode,alignment,lineSpacing,includeEmoji,truncationRect, CGRect, rect, UIFont *, font, UILineBreakMode, mode, UITextAlignment, alignment, float, spacing, BOOL, emoji, CGRect, truncation) { - //NSLog(@"XXX: &\"%@\" %@ \"%@\" %u %u %g %u %@", self, NSStringFromCGRect(rect), font, mode, alignment, spacing, emoji, NSStringFromCGRect(truncation)); + //NSLog(@"XXX: @\"%@\" %@ \"%@\" %u %u %g %u %@", self, NSStringFromCGRect(rect), font, mode, alignment, spacing, emoji, NSStringFromCGRect(truncation)); WBStringDrawingState *state(stringDrawingState_); if (state == NULL) -- 2.45.2