forked from Cocoanetics/DTCoreText
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
DTCoreText Programming Guide | ||
============================ | ||
|
||
This document is meant to serve as a collection of programming questions related to DTCoreText. | ||
|
||
Smoke Test | ||
---------- | ||
|
||
After having integrated DTCoreText and its dependencies into your project you should be able to build your app be able to use DTCoreText functionality. As a quick *Smoke Test* - to see if all is setup correctly - you can test your setup by adding this code to your app delegate: | ||
|
||
|
||
#import "DTCoreText.h" | ||
|
||
NSString *html = @"<p>Some Text</p>"; | ||
NSData *data = [html dataUsingEncoding:NSUTF8StringEncoding]; | ||
|
||
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTMLData:data | ||
documentAttributes:NULL]; | ||
NSLog(@"%@", attrString); | ||
|
||
You should see that this executes and that the NSLog outputs a description of the generated attributed string. | ||
|
||
Font Matching Performance | ||
------------------------- | ||
|
||
DTCoreText uses the `DTCoreTextFontOverrides.plist` file - if present in your app bundle - to pre-populate the font matching table. This table has the desired font name for each combination of font family name, italic and bold traits. | ||
|
||
Depending on your use case you may want to add your own custom fonts to the plist or use the plist that is part of the DTCoreText demo app. | ||
|
||
The override table is populated when a DTCoreTextFontDescriptor class is instantiated for the first time. To start the loading process you can add the following to your app delegate. | ||
|
||
[DTCoreTextFontDescriptor class]; // preload font matching table |