Questions tagged [textkit]

Text Kit is, collectively, a set of classes and protocols in iOS 7's UIKit framework that provide high-quality typographical services.

Text Kit, introduced in iOS 7, is a set of classes and protocols providing high quality typographical services including text layout, storage and display. It also enables direct control of typographical features such as kerning, ligatures, line break behaviour and justification. Text-related UIKit classes in iOS 7 - namely UITextView, UITextField and UILabel - are based on the Text Kit layout engine.

Allowing fine-grained control of fonts and styles through a mechanism Apple calls "Dynamic Type", Text Kit brings a much more refined an detailed system for text-handling to iOS.

272 questions
0
votes
1 answer

Dynamic Text Size and System Font in iOS

I can't really understand why in the world Apple decided to fix the font family to the system font when using Text Sizes. I saw a couple of tricks here on Stackoverflow that let me change font descriptor programmatically in relation to user…
MatterGoal
  • 16,038
  • 19
  • 109
  • 186
0
votes
0 answers

How append string to a new line after setting exclusionPaths Rather than use NSTextAttachment?

How UITextView can append string to a new line like below screenshot show? Thanks for helping me. Here is my code. main code: - (void)viewDidLoad { [super viewDidLoad]; NSTextStorage *storage = [NSTextStorage new]; NSLayoutManager…
james
  • 643
  • 4
  • 24
0
votes
2 answers

Change NSTextAttachment image don't work immediately even in main queue

I use NSTextAttachment to Display a placeholder image . when click this image , I want to show another image. I do this in UItextView delegate method : -(BOOL)textView:(UITextView *)textView shouldInteractWithTextAttachment:(NSTextAttachment…
james
  • 643
  • 4
  • 24
0
votes
1 answer

Manage selection in text kit using swift

I want to convert the following void function written in objective-c to swift but it won't work the way I do it. It goes mostly wrong with step 1,2,4 and 5 cause I don't know how I should translate it. -(void)applyStyletoSelection:(NSString…
0
votes
1 answer

locationForGlyphAtIndex returning wrong value

I'm trying to get the location of glyphs in an NSLayoutManager, but on a few isolated occasions I'm getting what appears to be incorrect values. For example: two f's together in Helvetica Neue size 16. The x value of the 2nd f should be around 4,…
user2994359
  • 400
  • 4
  • 13
0
votes
2 answers

Is CoreText faster than Text Kit?

In a case where I have a multiple custom UITableViewCells or UICollectionViewCells with several labels and UI elements, and maintaining good scroll-speed is essential, will CoreText be a faster solution than TextKit?
Adama
  • 1,101
  • 8
  • 26
0
votes
1 answer

MINIMUM bounding rect width for NSAttributedString

I have an NSAttributedString which I draw into a rectangle (no text views here.) I allow the user to resize that rectangle thus forcing the text to wrap onto multiple lines. All is good and I'm using NSTextContainer etc to figure out the text…
Scotty
  • 2,019
  • 1
  • 20
  • 31
0
votes
3 answers

.tmlanguage escape sequences and rule priorities

I'm implementing a syntax highlighter in Apple's Swift language by parsing .tmlanguage files and applying styles to a NSMutableAttributtedString. I'm testing with javascript code, a javascript.tmlanguage file, and the monokai.tmtheme theme (both…
OscarVGG
  • 2,632
  • 2
  • 27
  • 34
0
votes
0 answers

Changing font of all UI elements using Text Kit

One of the most common problem faced by iOS developers is to change the font of all the UI elements in one go. With the introduction of UIAppearance Protocol setting the font did become very convenient, since then I've been using appearance to…
Aditya Mathur
  • 1,185
  • 17
  • 27
0
votes
2 answers

How to move text under image in UITextView?

I want to write text in textView and later when I add an image to textView I just want this text move under that image. So.. when i made image smaller than bounds of textView text stays on the same line and only moves to the right and appears near…
andrey
  • 671
  • 1
  • 9
  • 20
0
votes
1 answer

iOS7 Type into UITextView with Line Spacing and keep formatting using TextKit

I came across this great example which helped me understand how I can achieve line spacing / paragraph spacing as you type inside a UITextView with iOS7, however there is a problem and I am hoping someone can help me with resolving an issue as I am…
Wael
  • 489
  • 6
  • 19
0
votes
2 answers

Is there a way to get access to the layoutmanager for a UITextField

UITextView exposes its NSLayoutManager, allowing clients to add custom styling as text is edited (e.g. this article implements a UITextView with syntax highlighting: http://www.objc.io/issue-5/getting-to-know-textkit.html) Is there a way to get the…
0
votes
1 answer

Setting different font properties for certain characters in iOS TextKit

How would I go about setting different font properties for the degree symbol in this string? https://i.stack.imgur.com/GaDu6.png I am currently setting the value like this: currentTemp.text = [NSString stringWithFormat:@"%d°",…
warrantsuspect
  • 221
  • 4
  • 10
0
votes
2 answers

UIFont and Retina displays. Double the size?

I think I might already know the answer, but here is the situation: I have a spec sheet that requires the font size to be: 11pt. When I do: UIFont *font = [UIFont fontWithName:@"Gotham" size:11.0]; Then font is tiny on my retina iPad 4. When I…
0
votes
2 answers

iOS 7 autoresizing UITextView with AutoLayout breaks line randomly

I'd like to have a simple UITextView which automatically resizes to fit its content. With AutoLayout this is quite straightforward: I add the UITextView to my view, set two contraints to anchor the UITextView in the top-left corner, disable…
Guillaume Algis
  • 10,705
  • 6
  • 44
  • 72