Archive for the ‘Cocoa’ Category

iPhone OS Installed Fonts

Thursday, June 10th, 2010

Chad Fuller posted a list of fonts installed with iPhone OS 2.2.1. I needed to see a more updated list for iPhone OS 3.1.

Deriving from his code, I used the following snippet to output a list of installed fonts to the console.

for (NSString *family in [UIFont familyNames] ) {
  NSLog(@"Family: %@", family);
  NSLog(@"Fonts:\n");
  for (NSString *name in [UIFont fontNamesForFamilyName: family]) {
    NSLog(@"\t%@", name);
  }
  NSLog(@"\n");
}

Here’s the list of fonts reported for iPhone OS 3.1.3.

Family: AppleGothic
Fonts:
	 AppleGothic

Family: Hiragino Kaku Gothic ProN
Fonts:
	 HiraKakuProN-W6
	 HiraKakuProN-W3

Family: Arial Unicode MS
Fonts:
	 ArialUnicodeMS

Family: Heiti K
Fonts:
	 STHeitiK-Medium
	 STHeitiK-Light

Family: DB LCD Temp
Fonts:
	 DBLCDTempBlack

Family: Helvetica
Fonts:
	 Helvetica-Oblique
	 Helvetica-BoldOblique
	 Helvetica
	 Helvetica-Bold

Family: Marker Felt
Fonts:
	 MarkerFelt-Thin

Family: Times New Roman
Fonts:
	 TimesNewRomanPSMT
	 TimesNewRomanPS-BoldMT
	 TimesNewRomanPS-BoldItalicMT
	 TimesNewRomanPS-ItalicMT

Family: Verdana
Fonts:
	 Verdana-Bold
	 Verdana-BoldItalic
	 Verdana
	 Verdana-Italic

Family: Georgia
Fonts:
	 Georgia-Bold
	 Georgia
	 Georgia-BoldItalic
	 Georgia-Italic

Family: Arial Rounded MT Bold
Fonts:
	 ArialRoundedMTBold

Family: Trebuchet MS
Fonts:
	 TrebuchetMS-Italic
	 TrebuchetMS
	 Trebuchet-BoldItalic
	 TrebuchetMS-Bold

Family: Heiti TC
Fonts:
	 STHeitiTC-Light
	 STHeitiTC-Medium

Family: Geeza Pro
Fonts:
	 GeezaPro-Bold
	 GeezaPro

Family: Courier
Fonts:
	 Courier
	 Courier-BoldOblique
	 Courier-Oblique
	 Courier-Bold

Family: Arial
Fonts:
	 ArialMT
	 Arial-BoldMT
	 Arial-BoldItalicMT
	 Arial-ItalicMT

Family: Heiti J
Fonts:
	 STHeitiJ-Medium
	 STHeitiJ-Light

Family: Arial Hebrew
Fonts:
	 ArialHebrew
	 ArialHebrew-Bold

Family: Courier New
Fonts:
	 CourierNewPS-BoldMT
	 CourierNewPS-ItalicMT
	 CourierNewPS-BoldItalicMT
	 CourierNewPSMT

Family: Zapfino
Fonts:
	 Zapfino

Family: American Typewriter
Fonts:
	 AmericanTypewriter
	 AmericanTypewriter-Bold

Family: Heiti SC
Fonts:
	 STHeitiSC-Medium
	 STHeitiSC-Light

Family: Helvetica Neue
Fonts:
	 HelveticaNeue
	 HelveticaNeue-Bold

Family: Thonburi
Fonts:
	 Thonburi-Bold
	 Thonburi

Doc-based Application Xcode Project Template

Thursday, December 3rd, 2009

Just started a collection of Xcode file and project templates on bitbucket.org.

The big feature of the collection is a project template for a document-based Cocoa application with explicit NSWindowControllers.  This project illustrates using the Cocoa document architecture to implement an explicitly managed main window and an associated inspector window.

Download a zip archive of the project template here.

SOLogger: a Cocoa ASL Logging framework

Wednesday, August 19th, 2009

I spent some time recently putting together a Cocoa interface to the built-in Apple System Logging (ASL) facility.

Following Peter Hosey’s excellent blog series on ASL and some other tidbits on Cocoa-Dev, I fashioned small and simple Cocoa framework for integrating ASL’s multi-leveled logging into your project.


#import <SOLogger/SOLogger.h>

SOLogger *logger;

logger = [SOLogger loggerForFacility: @"com.example.MyApp" options:ASL_OPT_STDERR];

[logger debug:@"A debugging note on: %@", [NSDate date]];

[logger info:@"We just did something."];
[logger notice:@"That's going to leave a mark"];
[logger warning:@"WTF?"];
[logger alert:@"WTF!"];
[logger critical:@"OMG"];
[logger panic:@"OMG WTF!"];

An interesting feature of SOLogger (courtesy of ASL) is that you can create separate loggers for subsystems in your code, potentially logging them to separate destinations.

I host the SOLogger project on Bitbucket with a BSD License.

Check it out.

Running selected unit tests with GHUnit

Saturday, March 14th, 2009

I love the sanity that GHUnit brings to running and debugging unit tests. The under-documented Xcode 3 mojo needed to configure SenTest unit test bundles for debugging throws a wet towel on the practice of test-driven Cocoa development.

The current GHUnit distribution runs all unit tests found in your app or framework. I did some work today to enable running a selected test cases and individual unit tests.

This works similarly to the SenTestingKit’s otest tool. You specify a unit test case and/or test name to run as an argument to the GHUnit test application.

In the Xcode’s executable panel for the test application, add arguments of the form:

-Test UserTests
-Test UserTests/testEmptyUserName
-Test All

When you run or debug the test app, only the specified test case or individual test will be executed. The argument -Test All will run all available unit test cases.

The patch file is here and works for Mac OS X. To apply the patch:

$ cd your-GHUnit-project-directory
$ patch -p1 < path-to-patch-file

I’ve submitted the patch to Gabriel, so maybe it’ll make it into a future release.

cocoawithlove.com

Saturday, August 2nd, 2008

[MattGallagher programming:Cocoa with:Love] is one of my new favorite Cocoa blogs.  I discovered it through Planet Cocoa, so thanks for that.

Matt writes at a sweet spot of Cocoa geekness style that I find really appealing.  He uses code recipes balanced with concise commentary to pack a lot of goodness into a tight blog posting.  I want my blog articles to read like his.

Implementing the reflection effect on images

Saturday, August 2nd, 2008

bithaus blogs about a category on NSImageView to do the reflection effect.  A must for modern sexy UI.

See this on cocoadev.

C4[2] Registration is open!…and closed.

Saturday, August 2nd, 2008

Well, shit.

8:30 PM, July 31: 75% of seats for C4[2] have been sold.  (C4 Twitter)

2:01 AM, August 1: C4[2] registration opens for the public early Friday morning, 2:01 AM, 8/1.  

9:00 AM, August 2: C4[2] is sold out.

I completely missed the announcement until this morning.  And apparently, previous attendees got first dibs at an early private registration.

C4 has been a small gathering in past years, with attendees capped at around 75.  So there were likely around 18-20 open spots left when public registration opened.  That’s not very many.

Looks like C4 is becoming an exclusive event along the lines of Davos.  Someday, I’ll be invited.  Oh, crap, I just spilled my milk…