Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Jun 29, 2013
0 parents commit 2ab3401
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.deb
_
obj
*.o
theos
*~
*.save
.DS_Store
Empty file added .theos/fakeroot
Empty file.
1 change: 1 addition & 0 deletions .theos/packages/ws.hbang.fontee-0.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1-44+debug
1 change: 1 addition & 0 deletions .theos/packages/ws.hbang.fontee-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0-1
1 change: 1 addition & 0 deletions .theos/packages/ws.hbang.fontee-1.0.1~beta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.1~beta-41
1 change: 1 addition & 0 deletions Fontee.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.UIKit" ); }; }
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TARGET = :clang

include theos/makefiles/common.mk

TWEAK_NAME = Fontee
Fontee_FILES = Tweak.xm
Fontee_FRAMEWORKS = UIKit
Fontee_PRIVATE_FRAMEWORKS = GraphicsServices

include $(THEOS_MAKE_PATH)/tweak.mk
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Fontee
Replace Helvetica Neue Bold with Helvetica Neue, and Helvetica Neue with Helvetica Neue Light. Once you go light, stock iOS just looks too fat. [Apache 2 license.](https://www.apache.org/licenses/LICENSE-2.0.html)
67 changes: 67 additions & 0 deletions Tweak.xm
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include <substrate.h>
#import <GraphicsServices/GraphicsServices.h>

BOOL forceUltraLight = NO;

static GSFontRef (*HBFTOldGSCreateFontWithName)(const char *fontName, GSFontTraitMask traits, CGFloat fontSize);

GSFontRef HBFTNewGSCreateFontWithName(const char *fontName, GSFontTraitMask traits, CGFloat fontSize) {
if (fontName == NULL || (fontName != NULL && (
strcmp(fontName, "Helvetica") == 0 || strcmp(fontName, "Helvetica-Bold") == 0 ||
strcmp(fontName, "Helvetica-Italic") == 0 || strcmp(fontName, "Helvetica-BoldItalic") == 0 ||
strcmp(fontName, "Helvetica Neue") == 0 || strcmp(fontName, "HelveticaNeue") == 0 ||
strcmp(fontName, "HelveticaNeue-Bold") == 0 || strcmp(fontName, "HelveticaNeue-Italic") == 0 ||
strcmp(fontName, "HelveticaNeue-BoldItalic") == 0 || strcmp(fontName, "HelveticaNeue-Light") == 0 ||
strcmp(fontName, ".Helvetica NeueUI") == 0 || strcmp(fontName, ".HelveticaNeueUI") == 0 ||
strcmp(fontName, ".PhoneKeyCaps") == 0 || strcmp(fontName, ".PhoneKeyCapsTwo") == 0
))) {
if (forceUltraLight || (fontName != NULL && (strcmp(fontName, ".PhoneKeyCaps") == 0 || strcmp(fontName, ".PhoneKeyCapsTwo") == 0))) {
return HBFTOldGSCreateFontWithName("HelveticaNeue-UltraLight", traits, fontSize);
} else if (traits == GSBoldFontMask + GSItalicFontMask || (fontName != NULL && (strcmp(fontName, "Helvetica-BoldItalic") == 0 || strcmp(fontName, "HelveticaNeue-BoldItalic") == 0))) {
return HBFTOldGSCreateFontWithName("HelveticaNeue", GSItalicFontMask, fontSize);
} else if (traits == GSBoldFontMask || (fontName != NULL && (strcmp(fontName, "Helvetica-Bold") == 0 || strcmp(fontName, "HelveticaNeue-Bold") == 0))) {
return HBFTOldGSCreateFontWithName("HelveticaNeue", kGSFontTraitNone, fontSize);
} else {
return HBFTOldGSCreateFontWithName("HelveticaNeue-Light", traits, fontSize);
}
} else {
return HBFTOldGSCreateFontWithName(fontName, traits, fontSize);
}
}

%group SBHooks
%hook TPLCDTextView
- (void)drawRect:(CGRect)rect {
forceUltraLight = YES;
UIFont *font = MSHookIvar<UIFont *>(self, "_font");
object_setInstanceVariable(self, "_font", [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:font.pointSize]);
%orig;
forceUltraLight = NO;
}
%end

%hook TPLockTextView
- (id)initWithLabel:(id)arg1 fontSize:(float)arg2 trackWidthDelta:(float)arg3 {
forceUltraLight = YES;
self = %orig;
forceUltraLight = NO;
return self;
}

- (void)drawRect:(CGRect)rect {
forceUltraLight = YES;
UIFont *font = MSHookIvar<UIFont *>(self, "_labelFont");
object_setInstanceVariable(self, "_labelFont", [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:font.pointSize]);
%orig;
forceUltraLight = NO;
}
%end
%end

%ctor {
MSHookFunction(GSFontCreateWithName, HBFTNewGSCreateFontWithName, &HBFTOldGSCreateFontWithName);

if ([[NSBundle mainBundle].bundleIdentifier isEqualToString:@"com.apple.springboard"]) {
%init(SBHooks);
}
}
10 changes: 10 additions & 0 deletions control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: ws.hbang.fontee
Name: Fontee
Pre-Depends: firmware (>= 5.0)
Depends: mobilesubstrate
Version: 1.0.1~beta
Architecture: iphoneos-arm
Description: Make your system fonts lighter
Maintainer: HASHBANG Productions <[email protected]>
Author: HASHBANG Productions <[email protected]>
Section: Tweaks

0 comments on commit 2ab3401

Please sign in to comment.