An Objective-C wrapper around Apple's Core Text framework.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
MYSCoreText.xcodeproj
MYSCoreText
MYSCoreTextTests
.gitignore
LICENSE
MYSCoreText.podspec
README.md

README.md

MYSCoreText

An Objective-C wrapper around Apple's Core Text framework.

Installation

In your Podfile, add this line:

pod "MYSCoreText"

Example Usage

Create a framsetter:

NSString *string = (@"A long string of text to test on this with some really long strings of text"
                    @"that wrap and also some hard \nline breaks that will generate lines for us "
                    @"in a frame");
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string];
_framesetter = [[MYSFramesetter alloc] initWithAttributedString:attributedString];

Create a frame of text with a path:

CGPathRef path  = CGPathCreateWithRect(CGRectMake(0, 0, 30, 30), NULL);
NSRange range   = NSMakeRange(0, [_framesetter.attributedString length]);
MYSFrame *frame = [_framesetter frameWithRange:range path:path];

Then use all the cool methods to get all the info you'd ever want about the layout of the text:

for (MYSLine *line in frame.lines) {
  for (MYSRun *run in line.runs) {
    for (MYSGlyph *glyph in run.glyphs) {
      glyph.boundingBox; // => The bounding box of each glyph in the text.
    }
  }
}

Docs

http://cocoadocs.org/docsets/MYSCoreText/0.0.1/