add text to hostapp sample
rename duplicate of SkSVGPath.cpp



git-svn-id: http://skia.googlecode.com/svn/trunk@45 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/animator/SkSVGPath.cpp b/src/animator/SkParseSVGPath.cpp
similarity index 100%
rename from src/animator/SkSVGPath.cpp
rename to src/animator/SkParseSVGPath.cpp
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index a1a2bec..1720e10 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -266,6 +266,7 @@
 private:
     ATSUTextLayout  fLayout;
     ATSUStyle       fStyle;
+    CGColorSpaceRef fGrayColorSpace;
     
     static OSStatus MoveTo(const Float32Point *pt, void *cb);
     static OSStatus Line(const Float32Point *pt, void *cb);
@@ -298,10 +299,14 @@
     err = ::ATSUSetAttributes(fStyle,1,&sizeTag,&sizeTagSize,values);
 
     err = ::ATSUCreateTextLayout(&fLayout);
+
+    fGrayColorSpace = ::CGColorSpaceCreateDeviceGray();
 }
 
 SkScalerContext_Mac::~SkScalerContext_Mac()
 {
+    ::CGColorSpaceRelease(fGrayColorSpace);
+
     unref_ft_face(fRec.fFontID);
 
     ::ATSUDisposeTextLayout(fLayout);
@@ -332,31 +337,41 @@
     return glyph;
 }
 
+static void set_glyph_metrics_on_error(SkGlyph* glyph) {
+    glyph->fRsbDelta = 0;
+    glyph->fLsbDelta = 0;
+    glyph->fWidth    = 0;
+    glyph->fHeight   = 0;
+    glyph->fTop      = 0;
+    glyph->fLeft     = 0;
+    glyph->fAdvanceX = 0;
+    glyph->fAdvanceY = 0;
+}
+
 void SkScalerContext_Mac::generateAdvance(SkGlyph* glyph) {
     this->generateMetrics(glyph);
 }
 
-void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph)
-{
-    GlyphID glyphID = glyph->fID;
-
+void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
+    GlyphID glyphID = glyph->getGlyphID(fBaseGlyphCount);
     ATSGlyphScreenMetrics metrics;
-    
-    glyph->fRsbDelta = 0;
-    glyph->fLsbDelta = 0;
-    
-    OSStatus err = ATSUGlyphGetScreenMetrics(fStyle,1,&glyphID,0,true,true,&metrics);
-    if (err == noErr) {
+
+    OSStatus err = ATSUGlyphGetScreenMetrics(fStyle, 1, &glyphID, 0, true, true,
+                                             &metrics);
+    if (noErr != err) {
+        set_glyph_metrics_on_error(glyph);
+    } else {
         glyph->fAdvanceX = SkFloatToFixed(metrics.deviceAdvance.x);
         glyph->fAdvanceY = -SkFloatToFixed(metrics.deviceAdvance.y);
         glyph->fWidth = metrics.width;
         glyph->fHeight = metrics.height;
-        glyph->fTop = -sk_float_round2int(metrics.topLeft.y);
         glyph->fLeft = sk_float_round2int(metrics.topLeft.x);
+        glyph->fTop = -sk_float_round2int(metrics.topLeft.y);
     }
 }
 
-void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my) {
+void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx,
+                                              SkPaint::FontMetrics* my) {
 #if 0
     OSStatus ATSFontGetVerticalMetrics (
                                         ATSFontRef iFont,
@@ -375,42 +390,31 @@
 void SkScalerContext_Mac::generateImage(const SkGlyph& glyph)
 {
     SkAutoMutexAcquire  ac(gFTMutex);
-    
-    GlyphID glyphID = glyph.fID;
-    ATSGlyphScreenMetrics metrics= { 0 };
-    
     SkASSERT(fLayout);
-    OSStatus err = ::ATSUGlyphGetScreenMetrics(fStyle,1,&glyphID,0,true,true,&metrics);
+    OSStatus err;
 
-//    uint32_t w = metrics.width;
-//    uint32_t h = metrics.height;
-//    uint32_t pitch = (w + 3) & ~0x3;
-//    if (pitch != glyph.rowBytes()) {
-//        SkASSERT(false); // it's different from previously cacluated in generateMetrics(), so the size of glyph.fImage buffer is incorrect!
-//    }
-    
-    CGColorSpaceRef greyColorSpace = ::CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
-    CGContextRef contextRef = ::CGBitmapContextCreate((uint8_t*)glyph.fImage, glyph.fWidth, glyph.fHeight, 8, glyph.rowBytes(), greyColorSpace, kCGImageAlphaNone);
+    bzero(glyph.fImage, glyph.fHeight * glyph.rowBytes());
+    CGContextRef contextRef = ::CGBitmapContextCreate(glyph.fImage,
+                                            glyph.fWidth, glyph.fHeight, 8,
+                                            glyph.rowBytes(), fGrayColorSpace,
+                                            kCGImageAlphaNone);
     if (!contextRef) {
         SkASSERT(false);
         return;
     }
-        
-    ::CGContextSetFillColorSpace(contextRef, greyColorSpace); 
-    ::CGContextSetStrokeColorSpace(contextRef, greyColorSpace); 
-                
-    ::CGContextSetGrayFillColor(contextRef, 0.0, 1.0);
-    ::CGContextFillRect(contextRef, ::CGRectMake(0, 0, glyph.fWidth, glyph.fHeight));
-                
+
     ::CGContextSetGrayFillColor(contextRef, 1.0, 1.0);
-    ::CGContextSetGrayStrokeColor(contextRef, 1.0, 1.0);
     ::CGContextSetTextDrawingMode(contextRef, kCGTextFill);
     
     ATSUAttributeTag tag = kATSUCGContextTag;
     ByteCount size = sizeof(CGContextRef);
     ATSUAttributeValuePtr value = &contextRef;
-    err = ::ATSUSetLayoutControls(fLayout,1,&tag,&size,&value);
-    err = ::ATSUDrawText(fLayout,kATSUFromTextBeginning,kATSUToTextEnd,FloatToFixed(-metrics.topLeft.x),FloatToFixed(glyph.fHeight-metrics.topLeft.y));
+    err = ::ATSUSetLayoutControls(fLayout, 1, &tag, &size, &value);
+    SkASSERT(!err);
+    err = ::ATSUDrawText(fLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+                         SkIntToFixed(-glyph.fLeft),
+                         SkIntToFixed(glyph.fTop + glyph.fHeight));
+    SkASSERT(!err);
     ::CGContextRelease(contextRef);
 }
 
diff --git a/xcode/hostapp/CICarbonSample.xcodeproj/project.pbxproj b/xcode/hostapp/CICarbonSample.xcodeproj/project.pbxproj
index 7c7c0cd..556818d 100644
--- a/xcode/hostapp/CICarbonSample.xcodeproj/project.pbxproj
+++ b/xcode/hostapp/CICarbonSample.xcodeproj/project.pbxproj
@@ -10,8 +10,8 @@
 		002884150EFA97F80083E387 /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002884140EFA97F80083E387 /* test.cpp */; };
 		0028847B0EFAB46A0083E387 /* libcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 002884510EFAA35C0083E387 /* libcore.a */; };
 		002884BD0EFAB6A30083E387 /* libmaccore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 002884BC0EFAB69F0083E387 /* libmaccore.a */; };
-		002884D90EFABFE60083E387 /* SkFontHost_none.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002884D80EFABFE60083E387 /* SkFontHost_none.cpp */; };
 		004447A20EFC1DB400116F7C /* SkCreateCGImageRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 004447A10EFC1DB400116F7C /* SkCreateCGImageRef.cpp */; };
+		008D39120F0043260032662A /* SkFontHost_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 008D39110F0043260032662A /* SkFontHost_mac.cpp */; };
 		0156F80407C56A3000C6122B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0156F80307C56A3000C6122B /* Foundation.framework */; };
 		01FC44D507BD3BB800D228F4 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01FC44D407BD3BB800D228F4 /* Quartz.framework */; };
 		8D0C4E8D0486CD37000505A6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
@@ -55,8 +55,8 @@
 		002884140EFA97F80083E387 /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test.cpp; sourceTree = "<group>"; };
 		002884490EFAA35C0083E387 /* core.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = core.xcodeproj; path = ../core/core.xcodeproj; sourceTree = SOURCE_ROOT; };
 		002884B40EFAB69F0083E387 /* maccore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = maccore.xcodeproj; path = ../maccore/maccore.xcodeproj; sourceTree = SOURCE_ROOT; };
-		002884D80EFABFE60083E387 /* SkFontHost_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_none.cpp; path = ../../src/ports/SkFontHost_none.cpp; sourceTree = SOURCE_ROOT; };
 		004447A10EFC1DB400116F7C /* SkCreateCGImageRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkCreateCGImageRef.cpp; path = ../../src/utils/mac/SkCreateCGImageRef.cpp; sourceTree = SOURCE_ROOT; };
+		008D39110F0043260032662A /* SkFontHost_mac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_mac.cpp; path = ../../src/ports/SkFontHost_mac.cpp; sourceTree = SOURCE_ROOT; };
 		0156F80307C56A3000C6122B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
 		01FC44D407BD3BB800D228F4 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = "<absolute>"; };
 		0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -113,8 +113,8 @@
 		20286C29FDCF999611CA2CEA /* CICarbonSample */ = {
 			isa = PBXGroup;
 			children = (
+				008D39110F0043260032662A /* SkFontHost_mac.cpp */,
 				004447A10EFC1DB400116F7C /* SkCreateCGImageRef.cpp */,
-				002884D80EFABFE60083E387 /* SkFontHost_none.cpp */,
 				20286C2AFDCF999611CA2CEA /* Sources */,
 				20286C2CFDCF999611CA2CEA /* Resources */,
 				20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
@@ -243,8 +243,8 @@
 			files = (
 				8D0C4E900486CD37000505A6 /* main.c in Sources */,
 				002884150EFA97F80083E387 /* test.cpp in Sources */,
-				002884D90EFABFE60083E387 /* SkFontHost_none.cpp in Sources */,
 				004447A20EFC1DB400116F7C /* SkCreateCGImageRef.cpp in Sources */,
+				008D39120F0043260032662A /* SkFontHost_mac.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -344,6 +344,8 @@
 		01E2163E09EDAC6600E66AF8 /* Development */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				GCC_ENABLE_CPP_EXCEPTIONS = NO;
+				GCC_ENABLE_CPP_RTTI = NO;
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					SK_BUILD_FOR_MAC,
 					SK_DEBUG,
@@ -355,6 +357,8 @@
 		01E2163F09EDAC6600E66AF8 /* Deployment */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				GCC_ENABLE_CPP_EXCEPTIONS = NO;
+				GCC_ENABLE_CPP_RTTI = NO;
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					SK_BUILD_FOR_MAC,
 					SK_RELEASE,
diff --git a/xcode/hostapp/English.lproj/main.nib/classes.nib b/xcode/hostapp/English.lproj/main.nib/classes.nib
index ea58db1..c4b887e 100644
--- a/xcode/hostapp/English.lproj/main.nib/classes.nib
+++ b/xcode/hostapp/English.lproj/main.nib/classes.nib
@@ -1,4 +1,8 @@
-{
-IBClasses = ();
-IBVersion = 1;
-}
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IBVersion</key>
+	<string>1</string>
+</dict>
+</plist>
diff --git a/xcode/hostapp/English.lproj/main.nib/info.nib b/xcode/hostapp/English.lproj/main.nib/info.nib
index 63627e9..848f03c 100644
--- a/xcode/hostapp/English.lproj/main.nib/info.nib
+++ b/xcode/hostapp/English.lproj/main.nib/info.nib
@@ -1,24 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-	<key>IBDocumentLocation</key>
-	<string>117 84 356 240 0 0 1920 1178 </string>
-	<key>IBEditorPositions</key>
-	<dict>
-		<key>29</key>
-		<string>110 302 204 44 0 0 1920 1178 </string>
-	</dict>
 	<key>IBFramework Version</key>
-	<string>430.0</string>
+	<string>629</string>
+	<key>IBLastKnownRelativeProjectPath</key>
+	<string>../../CICarbonSample.xcodeproj</string>
 	<key>IBOldestOS</key>
-	<integer>3</integer>
+	<integer>5</integer>
 	<key>IBOpenObjects</key>
-	<array>
-		<integer>166</integer>
-	</array>
+	<array/>
 	<key>IBSystem Version</key>
-	<string>8A376</string>
+	<string>9F33</string>
 	<key>targetFramework</key>
 	<string>IBCarbonFramework</string>
 </dict>
diff --git a/xcode/hostapp/English.lproj/main.nib/objects.xib b/xcode/hostapp/English.lproj/main.nib/objects.xib
index 8f115b7..289202a 100644
--- a/xcode/hostapp/English.lproj/main.nib/objects.xib
+++ b/xcode/hostapp/English.lproj/main.nib/objects.xib
@@ -1,102 +1,76 @@
 <?xml version="1.0" standalone="yes"?>
 <object class="NSIBObjectData">
-  <string name="targetFramework">IBCarbonFramework</string>
   <object name="rootObject" class="NSCustomObject" id="1">
-    <string name="customClass">NSApplication</string>
   </object>
-  <array count="20" name="allObjects">
-    <object class="IBCarbonMenu" id="29">
-      <string name="title">main</string>
-      <array count="3" name="items">
-        <object class="IBCarbonMenuItem" id="185">
-          <string name="title">Foo</string>
-          <object name="submenu" class="IBCarbonMenu" id="184">
-            <string name="title">Foo</string>
-            <array count="1" name="items">
-              <object class="IBCarbonMenuItem" id="187">
-                <string name="title">About Foo</string>
-                <int name="keyEquivalentModifier">0</int>
-                <ostype name="command">abou</ostype>
-              </object>
-            </array>
-            <string name="name">_NSAppleMenu</string>
-          </object>
-        </object>
-        <object class="IBCarbonMenuItem" id="127">
-          <string name="title">File</string>
-          <object name="submenu" class="IBCarbonMenu" id="131">
-            <string name="title">File</string>
-            <array count="2" name="items">
-              <object class="IBCarbonMenuItem" id="135">
-                <string name="title">Page Setup…</string>
-                <string name="keyEquivalent">P</string>
-                <ostype name="command">page</ostype>
-              </object>
-              <object class="IBCarbonMenuItem" id="136">
-                <string name="title">Print…</string>
-                <string name="keyEquivalent">p</string>
-                <ostype name="command">prnt</ostype>
-              </object>
-            </array>
-          </object>
-        </object>
-        <object class="IBCarbonMenuItem" id="192">
-          <string name="title">Window</string>
-          <object name="submenu" class="IBCarbonMenu" id="195">
-            <string name="title">Window</string>
-            <array count="6" name="items">
-              <object class="IBCarbonMenuItem" id="190">
-                <boolean name="dynamic">TRUE</boolean>
-                <string name="title">Minimize</string>
-                <string name="keyEquivalent">m</string>
-                <ostype name="command">mini</ostype>
-              </object>
-              <object class="IBCarbonMenuItem" id="191">
-                <boolean name="dynamic">TRUE</boolean>
-                <string name="title">Minimize All</string>
-                <string name="keyEquivalent">m</string>
-                <int name="keyEquivalentModifier">1572864</int>
-                <ostype name="command">mina</ostype>
-              </object>
-              <object class="IBCarbonMenuItem" id="197">
-                <string name="title">Zoom</string>
-                <ostype name="command">zoom</ostype>
-              </object>
-              <object class="IBCarbonMenuItem" id="194">
-                <boolean name="separator">TRUE</boolean>
-              </object>
-              <object class="IBCarbonMenuItem" id="196">
-                <boolean name="dynamic">TRUE</boolean>
-                <string name="title">Bring All to Front</string>
-                <ostype name="command">bfrt</ostype>
-              </object>
-              <object class="IBCarbonMenuItem" id="193">
-                <boolean name="dynamic">TRUE</boolean>
-                <string name="title">Arrange in Front</string>
-                <int name="keyEquivalentModifier">1572864</int>
-                <ostype name="command">frnt</ostype>
-              </object>
-            </array>
-            <string name="name">_NSWindowsMenu</string>
-          </object>
-        </object>
-      </array>
-      <string name="name">_NSMainMenu</string>
+  <array count="19" name="allObjects">
+    <object class="IBCarbonMenuItem" id="136">
+      <string name="title">Print…</string>
+      <string name="keyEquivalent">p</string>
+      <ostype name="command">prnt</ostype>
     </object>
-    <reference idRef="127"/>
-    <reference idRef="131"/>
-    <reference idRef="135"/>
-    <reference idRef="136"/>
+    <object class="IBCarbonMenuItem" id="187">
+      <string name="title">About Foo</string>
+      <int name="keyEquivalentModifier">0</int>
+      <ostype name="command">abou</ostype>
+    </object>
+    <object class="IBCarbonMenuItem" id="197">
+      <string name="title">Zoom</string>
+      <ostype name="command">zoom</ostype>
+    </object>
+    <object class="IBCarbonMenuItem" id="191">
+      <string name="title">Minimize All</string>
+      <string name="keyEquivalent">m</string>
+      <boolean name="dynamic">TRUE</boolean>
+      <int name="keyEquivalentModifier">1572864</int>
+      <ostype name="command">mina</ostype>
+    </object>
+    <object class="IBCarbonMenu" id="131">
+      <string name="title">File</string>
+      <array count="2" name="items">
+        <object class="IBCarbonMenuItem" id="135">
+          <string name="title">Page Setup…</string>
+          <string name="keyEquivalent">P</string>
+          <ostype name="command">page</ostype>
+        </object>
+        <reference idRef="136"/>
+      </array>
+    </object>
+    <object class="IBCarbonMenuItem" id="190">
+      <string name="title">Minimize</string>
+      <string name="keyEquivalent">m</string>
+      <boolean name="dynamic">TRUE</boolean>
+      <ostype name="command">mini</ostype>
+    </object>
+    <object class="IBCarbonMenuItem" id="196">
+      <string name="title">Bring All to Front</string>
+      <boolean name="dynamic">TRUE</boolean>
+      <ostype name="command">bfrt</ostype>
+    </object>
+    <object class="IBCarbonMenuItem" id="194">
+      <boolean name="separator">TRUE</boolean>
+    </object>
+    <object class="IBCarbonMenuItem" id="193">
+      <string name="title">Arrange in Front</string>
+      <boolean name="dynamic">TRUE</boolean>
+      <int name="keyEquivalentModifier">1572864</int>
+      <ostype name="command">frnt</ostype>
+    </object>
     <object class="IBCarbonWindow" id="166">
-      <string name="windowRect">504 338 864 818 </string>
+      <boolean name="receiveUpdates">FALSE</boolean>
+      <boolean name="hasCloseBox">FALSE</boolean>
+      <boolean name="liveResize">TRUE</boolean>
+      <boolean name="compositing">TRUE</boolean>
+      <boolean name="asyncDrag">TRUE</boolean>
+      <boolean name="isConstrained">FALSE</boolean>
+      <boolean name="hideOnFullScreen">TRUE</boolean>
+      <boolean name="doesNotCycle">TRUE</boolean>
+      <int name="windowPosition">1</int>
+      <int name="scalingMode">1048576</int>
       <string name="title">Window</string>
       <object name="rootControl" class="IBCarbonRootControl" id="167">
-        <string name="bounds">0 0 360 480 </string>
         <string name="viewFrame">0 0 480 360 </string>
-        <array count="2" name="subviews">
+        <array count="1" name="subviews">
           <object class="IBCarbonHIView" id="200">
-            <string name="bounds">0 0 360 480 </string>
-            <string name="viewFrame">0 0 480 360 </string>
             <ostype name="controlSignature">ciHV</ostype>
             <int name="controlID">128</int>
             <object name="layoutInfo" class="IBCarbonHILayoutInfo">
@@ -105,89 +79,88 @@
               <int name="bindingBottomKind">2</int>
               <int name="bindingRightKind">2</int>
             </object>
-          </object>
-          <object class="IBCarbonSlider" id="201">
-            <string name="bounds">329 16 341 460 </string>
-            <string name="viewFrame">16 329 444 12 </string>
-            <ostype name="controlSignature">gSLD</ostype>
-            <int name="controlID">128</int>
-            <boolean name="small">TRUE</boolean>
-            <int name="controlSize">1</int>
-            <ostype name="command">gama</ostype>
-            <string name="helpTagText">Set the gamma of the background image</string>
-            <object name="layoutInfo" class="IBCarbonHILayoutInfo">
-              <int name="bindingLeftKind">1</int>
-              <int name="bindingBottomKind">2</int>
-              <int name="bindingRightKind">2</int>
-            </object>
-            <boolean name="isLive">TRUE</boolean>
-            <int name="numTickMarks">100</int>
-            <int name="orientation">2</int>
-            <int name="initialValue">75</int>
-            <int name="minimumValue">10</int>
+            <string name="viewFrame">0 0 480 360 </string>
+            <string name="bounds">0 0 360 480 </string>
           </object>
         </array>
+        <string name="bounds">0 0 360 480 </string>
       </object>
-      <boolean name="receiveUpdates">FALSE</boolean>
-      <boolean name="hasCloseBox">FALSE</boolean>
-      <boolean name="liveResize">TRUE</boolean>
-      <boolean name="compositing">TRUE</boolean>
-      <int name="windowPosition">1</int>
-      <boolean name="asyncDrag">TRUE</boolean>
-      <boolean name="isConstrained">FALSE</boolean>
-      <boolean name="hideOnFullScreen">TRUE</boolean>
-      <boolean name="hideOnSuspend">TRUE</boolean>
-      <boolean name="hasShadow">TRUE</boolean>
-      <int name="scalingMode">1048576</int>
-      <boolean name="doesNotCycle">TRUE</boolean>
-      <boolean name="inWindowMenu">TRUE</boolean>
+      <string name="windowRect">504 338 864 818 </string>
+      <string name="ScreenRectAtEncodeTime">0 0 768 1024 </string>
     </object>
-    <reference idRef="167"/>
-    <reference idRef="184"/>
-    <reference idRef="185"/>
-    <reference idRef="187"/>
-    <reference idRef="190"/>
-    <reference idRef="191"/>
-    <reference idRef="192"/>
-    <reference idRef="193"/>
-    <reference idRef="194"/>
+    <object class="IBCarbonMenu" id="29">
+      <string name="title">main</string>
+      <string name="name">_NSMainMenu</string>
+      <array count="3" name="items">
+        <object class="IBCarbonMenuItem" id="185">
+          <string name="title">Foo</string>
+          <object name="submenu" class="IBCarbonMenu" id="184">
+            <string name="title">Foo</string>
+            <string name="name">_NSAppleMenu</string>
+            <array count="1" name="items">
+              <reference idRef="187"/>
+            </array>
+          </object>
+        </object>
+        <object class="IBCarbonMenuItem" id="127">
+          <string name="title">File</string>
+          <reference name="submenu" idRef="131"/>
+        </object>
+        <object class="IBCarbonMenuItem" id="192">
+          <string name="title">Window</string>
+          <object name="submenu" class="IBCarbonMenu" id="195">
+            <string name="title">Window</string>
+            <string name="name">_NSWindowsMenu</string>
+            <array count="6" name="items">
+              <reference idRef="190"/>
+              <reference idRef="191"/>
+              <reference idRef="197"/>
+              <reference idRef="194"/>
+              <reference idRef="196"/>
+              <reference idRef="193"/>
+            </array>
+          </object>
+        </object>
+      </array>
+    </object>
     <reference idRef="195"/>
-    <reference idRef="196"/>
-    <reference idRef="197"/>
     <reference idRef="200"/>
-    <reference idRef="201"/>
-  </array>
-  <array count="20" name="allParents">
-    <reference idRef="1"/>
-    <reference idRef="29"/>
     <reference idRef="127"/>
-    <reference idRef="131"/>
-    <reference idRef="131"/>
-    <reference idRef="1"/>
-    <reference idRef="166"/>
+    <reference idRef="167"/>
+    <reference idRef="135"/>
+    <reference idRef="192"/>
     <reference idRef="185"/>
-    <reference idRef="29"/>
+    <reference idRef="184"/>
+  </array>
+  <array count="19" name="allParents">
+    <reference idRef="131"/>
     <reference idRef="184"/>
     <reference idRef="195"/>
     <reference idRef="195"/>
-    <reference idRef="29"/>
+    <reference idRef="127"/>
     <reference idRef="195"/>
     <reference idRef="195"/>
+    <reference idRef="195"/>
+    <reference idRef="195"/>
+    <reference idRef="1"/>
+    <reference idRef="1"/>
     <reference idRef="192"/>
-    <reference idRef="195"/>
-    <reference idRef="195"/>
     <reference idRef="167"/>
-    <reference idRef="167"/>
+    <reference idRef="29"/>
+    <reference idRef="166"/>
+    <reference idRef="131"/>
+    <reference idRef="29"/>
+    <reference idRef="29"/>
+    <reference idRef="185"/>
   </array>
-  <dictionary count="4" name="nameTable">
-    <string>Files Owner</string>
+  <dictionary count="3" name="nameTable">
+    <string>File&apos;s Owner</string>
     <reference idRef="1"/>
     <string>MainWindow</string>
     <reference idRef="166"/>
     <string>MenuBar</string>
     <reference idRef="29"/>
-    <string>View1</string>
-    <reference idRef="200"/>
   </dictionary>
-  <unsigned_int name="nextObjectID">202</unsigned_int>
+  <string name="targetFramework">IBCarbonFramework</string>
+  <unsigned_int name="nextObjectID">204</unsigned_int>
 </object>
diff --git a/xcode/hostapp/test.cpp b/xcode/hostapp/test.cpp
index 67f8332..4f66a82 100644
--- a/xcode/hostapp/test.cpp
+++ b/xcode/hostapp/test.cpp
@@ -13,6 +13,17 @@
 
     canvas->drawCircle(SkIntToScalar(100), SkIntToScalar(100),
                        SkIntToScalar(90), paint);
+    
+    const char text[] = "fry42";
+    const size_t len = strlen(text);
+
+    paint.setColor(SK_ColorWHITE);
+    paint.setTextSize(SkIntToScalar(50));
+    canvas->drawText(text, len, SkIntToScalar(100), SkIntToScalar(50), paint);
+    paint.setTextAlign(SkPaint::kCenter_Align);
+    canvas->drawText(text, len, SkIntToScalar(100), SkIntToScalar(100), paint);
+    paint.setTextAlign(SkPaint::kRight_Align);
+    canvas->drawText(text, len, SkIntToScalar(100), SkIntToScalar(150), paint);
 }
 
 static CGImageRef gImage;