Latest 0.0.1
Homepage https://github.com/mysterioustrousers/MYSCoreText
License MIT
Platforms ios 5.0, osx 10.7, requires ARC
Frameworks Foundation
Authors

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/

Latest podspec

{
    "name": "MYSCoreText",
    "version": "0.0.1",
    "summary": "An Objective-C wrapper around Apple's Core Text framework.",
    "description": "This allows you to easily create framesetters and frames of text and then access all the elements and geomentry of the typography.",
    "homepage": "https://github.com/mysterioustrousers/MYSCoreText",
    "license": "MIT",
    "authors": {
        "Adam Kirk": "[email protected]"
    },
    "platforms": {
        "ios": "5.0",
        "osx": "10.7"
    },
    "source": {
        "git": "https://github.com/mysterioustrousers/MYSCoreText.git",
        "tag": "0.0.1"
    },
    "source_files": "MYSCoreText/*.{h,m}",
    "private_header_files": "MYSCoreText/*_*.h",
    "frameworks": "Foundation",
    "requires_arc": true
}

Pin It on Pinterest

Share This