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
0 answers

The measured text size is not same when the text and font size are same

Code is as following: textSize = [text sizeWithAttributes:[self textAttributes:newFont]]; I ensure the input parameters are same. But the result is different. The text content is mixed with English and Chinese. It is: text = @"Start typing to…
Laurence Fan
  • 1,074
  • 1
  • 11
  • 15
0
votes
1 answer

NSLayoutManager keep with next

I'm trying to implement custom pagination such as 'keep with next paragraph' or 'keep lines on same page'. But after reading Apple docs and googling I still don't have a clue how to do that. I guess that the main point of interest is the delegate…
Vitalii Vashchenko
  • 1,777
  • 1
  • 13
  • 23
0
votes
0 answers

Trouble aligning baselines of NSLayoutManager

I'm developing a custom UIView that renders text using a number of separate NSLayoutManager objects. (This view has text positioning requirements beyond what the built-in text view classes can support.) I'm having a hard time getting the correct…
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
0
votes
2 answers

unexpected crash when using custom fonts with swift

i am trying to determine the size of attributedString with method func boundingRect(with size: CGSize, options: NSStringDrawingOptions = [], context: NSStringDrawingContext?) -> CGRect and thats my code paragraphRect =…
Gabrail
  • 216
  • 2
  • 16
0
votes
1 answer

UITextView will shorten text?

How to know wether UITextView will shorten text because lack of space? I know I can calculate with boundingRectWithSize and sizeThatFit, but what if exclusionPaths of the UITextView is changed. I want lay out string in a polygon, and increase…
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
1 answer

Align baselines with characters in large line heights with Text Kit

When I draw an attributed string with a fixed line height with Text Kit, the characters always get aligned to the bottom of the line fragment. While this would make sense on one line with characters varying in size, this breaks the flow of the text…
Pim
  • 86
  • 5
0
votes
2 answers

UITextView not scroll properly when using TextKit

I config a textView in a UIViewController like following: textView configuration but when controller viewDidAppear I found that UITextView's contentSize = {375, 242} and UITextView can not scroll. But if i tap the textView, let the textView begin…
Conan
  • 1
0
votes
1 answer

Get Frame Of line of Text of UILabel when Text Alignment in Center

My label size is W= 190 H =322 and the text in label is in center alignment like I want an orange box character of line of text frame from UILabel
Keyur
  • 180
  • 1
  • 5
  • 20
0
votes
1 answer

Why when using TextKit to render text does the second line end up shorter than the first?

Sample project: http://d.pr/f/1coXu I'm using TextKit to render some text into what is essentially a very basic recreation of UILabel. The code is very simple and in this example just draws a hardcoded NSAttributedString into the view itself: class…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
0
votes
1 answer

How to build a rich text view like Medium iOS app using Text Kit?

It's a rich text view, with multiple images(variant height) among the text, and each of them sits between two paragraphs. Please refer to the screenshot. I know that Text Kit supports exclusion paths, is it possible to build such a rich text view…
Evan
  • 335
  • 1
  • 3
  • 11
0
votes
1 answer

How do I receive notifications when TextKit's NSTextContainer's size changes?

I need to know when TextKit's NSTextContainer's size changes, so I can update some caches in my NSLayoutManager. How can I receive notifications when size changes? Does TextKit in general (and NSTextContainer's size property specifically) support…
Heath Borders
  • 30,998
  • 16
  • 147
  • 256
0
votes
1 answer

TextKit: can´t change Bold Font to "UnBold" in Swift

I have a TextView with some text, which font is Bold. And i´ve a button. When this button is tapped, the Bold Font should change to "UnBold" There´s a ViewController & a class called "FontManager" to manage the Fonts of the TextKit/UITextView. My…
Ulli H
  • 1,748
  • 1
  • 19
  • 32
0
votes
1 answer

UIPageViewController/TextKit count number of pages

How can I count the number of pages of text if I have a very long NSTextStorage and I know CGSize of NSTextContainer? Is there a standard procedure for this thing or some way to count it dynamically? I can't find a good tutorial to make an iBooks…
Oleg Tretiakov
  • 159
  • 1
  • 12
0
votes
2 answers

NSLayoutManager Delegate not called

I wonder why my delegate method - (void)layoutManager:(NSLayoutManager *)layoutManager didCompleteLayoutForTextContainer:(NSTextContainer *)textContainer atEnd:(BOOL)layoutFinishedFlag not called, i used this code: self.storage =…
Yasser Farrag
  • 307
  • 2
  • 12
0
votes
1 answer

NSLayoutManager: Calling setLocation:forStartOfGlyphRange: does not change the position of the drawn glyph

I created a simple NSLayoutManager subclass that should allow me to change the first glyphs origin for a given range: @implementation GRZCategoryLinkLayoutManager - (void)invalidateLayoutForCharacterRange:(NSRange)charRange…