FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AsyncDisplayKit/AsyncDisplayKit/TextKit/ASTextKitRenderer.h at master · HackPlan/AsyncDisplayKit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
HackPlan
/
AsyncDisplayKit
Public
forked from
facebookarchive/AsyncDisplayKit
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
AsyncDisplayKit
/
AsyncDisplayKit
/
TextKit
/
ASTextKitRenderer.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
98 lines (71 loc) · 3.29 KB
Breadcrumbs
AsyncDisplayKit
/
AsyncDisplayKit
/
TextKit
/
ASTextKitRenderer.h
Copy path
File metadata and controls
executable file
·
98 lines (71 loc) · 3.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
//
ASTextKitRenderer.h
//
AsyncDisplayKit
//
//
Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
This source code is licensed under the BSD-style license found in the
//
LICENSE file in the root directory of this source tree. An additional grant
//
of patent rights can be found in the PATENTS file in the same directory.
//
#
import
<
vector
>
#
import
<
UIKit/UIKit.h
>
#
import
"
ASTextKitAttributes.h
"
@class
ASTextKitContext;
@class
ASTextKitShadower;
@class
ASTextKitFontSizeAdjuster;
@protocol
ASTextKitTruncating;
/*
*
ASTextKitRenderer is a modular object that is responsible for laying out and drawing text.
A renderer will hold onto the TextKit layouts for the given attributes after initialization. This may constitute a
large amount of memory for large enough applications, so care must be taken when keeping many of these around in-memory
at once.
This object is designed to be modular and simple. All complex maintenance of state should occur in sub-objects or be
derived via pure functions or categories. No touch-related handling belongs in this class.
ALL sizing and layout information from this class is in the external coordinate space of the TextKit components. This
is an important distinction because all internal sizing and layout operations are carried out within the shadowed
coordinate space. Padding will be added for you in order to ensure clipping does not occur, and additional information
on this transform is available via the shadower should you need it.
*/
@interface
ASTextKitRenderer
:
NSObject
/*
*
Designated Initializer
@discussion Sizing will occur as a result of initialization, so be careful when/where you use this.
*/
- (
instancetype
)
initWithTextKitAttributes
:
(
const
ASTextKitAttributes &)
textComponentAttributes
constrainedSize
:
(
const
CGSize)
constrainedSize
;
@property
(
nonatomic
,
strong
,
readonly
) ASTextKitContext *context;
@property
(
nonatomic
,
strong
,
readonly
)
id
<ASTextKitTruncating> truncater;
@property
(
nonatomic
,
strong
,
readonly
) ASTextKitFontSizeAdjuster *fontSizeAdjuster;
@property
(
nonatomic
,
strong
,
readonly
) ASTextKitShadower *shadower;
@property
(
nonatomic
,
assign
,
readonly
) ASTextKitAttributes attributes;
@property
(
nonatomic
,
assign
,
readonly
) CGSize constrainedSize;
@property
(
nonatomic
,
assign
,
readonly
) CGFloat currentScaleFactor;
#
pragma mark
- Drawing
/*
*
Draw the renderer's text content into the bounds provided.
@param bounds The rect in which to draw the contents of the renderer.
*/
- (
void
)
drawInContext
:
(CGContextRef)
context
bounds
:
(CGRect)
bounds
;
#
pragma mark
- Layout
/*
*
Returns the computed size of the renderer given the constrained size and other parameters in the initializer.
*/
- (CGSize)
size
;
#
pragma mark
- Text Ranges
/*
*
The character range from the original attributedString that is displayed by the renderer given the parameters in the
initializer.
*/
@property
(
nonatomic
,
assign
,
readonly
) std::vector<NSRange> visibleRanges;
/*
*
The number of lines shown in the string.
*/
- (
NSUInteger
)
lineCount
;
@end
@interface
ASTextKitRenderer
(ASTextKitRendererConvenience)
/*
*
Returns the first visible range or an NSRange with location of NSNotFound and size of 0 if no first visible
range exists
*/
@property
(
nonatomic
,
assign
,
readonly
)
NSRange
firstVisibleRange;
@end
Back
|
FazBrowse Home
|
New Git URL