Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 73 lines (50 sloc) 2.444 kb
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
1 //
05aa188 David Hoerl Looking real good now - no leaks
dhoerl authored
2 // DTCoreTextLayoutLine.h
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
3 // CoreTextExtensions
4 //
5 // Created by Oliver Drobnik on 1/24/11.
6 // Copyright 2011 Drobnik.com. All rights reserved.
7 //
8
9
2c45232 Jean-Charles BERTIN Fixed CoreText include for MacOS target.
jcbertin authored
10 #if TARGET_OS_IPHONE
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
11 #import <CoreText/CoreText.h>
2c45232 Jean-Charles BERTIN Fixed CoreText include for MacOS target.
jcbertin authored
12 #elif TARGET_OS_MAC
13 #import <ApplicationServices/ApplicationServices.h>
14 #endif
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
15
16 @class DTCoreTextLayoutFrame;
17
18 @interface DTCoreTextLayoutLine : NSObject
fee4f7f Oliver Drobnik Moved IVARs to .h to allow access from subclasses. Compatibility updates...
authored
19 {
20 NSInteger _stringLocationOffset; // offset to modify internal string location to get actual location
21 }
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
22
e4677a1 Oliver Drobnik Removed need to have a copy of the attributed substring in each line. in...
authored
23 - (id)initWithLine:(CTLineRef)line;
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
24
25 - (NSRange)stringRange;
26 - (NSInteger)numberOfGlyphs;
27 - (CGRect)frameOfGlyphAtIndex:(NSInteger)index;
44b2482 Oliver Drobnik Implemented merging of multiple glyph runs (e.g. Chinese characters in a...
authored
28 - (NSArray *)glyphRunsWithRange:(NSRange)range;
29 - (CGRect)frameOfGlyphsWithRange:(NSRange)range;
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
30 - (CGRect)imageBoundsInContext:(CGContextRef)context;
d729aff Oliver Drobnik added offsetForStringIndex method on line
authored
31 - (NSArray *)stringIndices;
32 - (CGFloat)offsetForStringIndex:(NSInteger)index;
f293f65 Oliver Drobnik Added methods and removed test code
authored
33 - (NSInteger)stringIndexForPosition:(CGPoint)position;
1f34f29 Oliver Drobnik (Sponsored by AntiLoop.com) Reimplemented typesetting with manual types...
authored
34
35
16c72e0 Oliver Drobnik Correct text alignment with new typesetter-based layouting
authored
36 /**
37 @name Creating Variants
38 */
39
40 /**
41 Creates a version of the receiver that is justified to the given width.
42
43 @param justificationFactor Full or partial justification. When set to `1.0` or greater, full justification is performed. If this parameter is set to less than `1.0`, varying degrees of partial justification are performed. If it is set to `0` or less, no justification is performed.
44 @param justificationWidth The width to which the resultant line is justified. If justificationWidth is less than the actual width of the line, then negative justification is performed (that is, glyphs are squeezed together).
45 */
46 - (DTCoreTextLayoutLine *)justifiedLineWithFactor:(CGFloat)justificationFactor justificationWidth:(CGFloat)justificationWidth;
47
48
1f34f29 Oliver Drobnik (Sponsored by AntiLoop.com) Reimplemented typesetting with manual types...
authored
49
6dd3808 Oliver Drobnik Fixed missing underlines (CTRun does not draw them), optimized positioni...
authored
50 - (void)drawInContext:(CGContextRef)context;
51
1f34f29 Oliver Drobnik (Sponsored by AntiLoop.com) Reimplemented typesetting with manual types...
authored
52
53 /** Adjust the baselines of all lines in this layout frame to fit the heights of text attachments.
54
55 This is used to work around a CoreText bug that was fixed in iOS 4.2
56
57 @returns `YES` if the line needed an adjustment, `NO` if no adjustment was carried out
58 */
04dac2f Oliver Drobnik New approach for fixing the image squishing bug (iOS < 4.2) by adjusting...
authored
59 - (BOOL)correctAttachmentHeights:(CGFloat *)downShift;
60
7acc1c9 Oliver Drobnik Added convenience method to calculate new baseline for a line following ...
authored
61
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
62 @property (nonatomic, assign) CGRect frame;
05aa188 David Hoerl Looking real good now - no leaks
dhoerl authored
63 @property (nonatomic, strong, readonly) NSArray *glyphRuns;
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
64
89020a7 Oliver Drobnik correct frame height for < 4.2 image squishing bug, so that for selectiv...
authored
65 @property (nonatomic, assign) CGFloat ascent; // needs to be modifyable
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
66 @property (nonatomic, assign, readonly) CGFloat descent;
67 @property (nonatomic, assign, readonly) CGFloat leading;
6dd3808 Oliver Drobnik Fixed missing underlines (CTRun does not draw them), optimized positioni...
authored
68 @property (nonatomic, assign, readonly) CGFloat trailingWhitespaceWidth;
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
69
04dac2f Oliver Drobnik New approach for fixing the image squishing bug (iOS < 4.2) by adjusting...
authored
70 @property (nonatomic, assign) CGPoint baselineOrigin;
5f5390d Oliver Drobnik Objectified all of layout, completely revamped drawing
authored
71
72 @end
Something went wrong with that request. Please try again.