In this article we will tell you about the advantages of using Core Text framework for developing digital versions of newspapers, magazines and books for iPad. Our company successfully employed this technology while working on several projects related to digital publishing. Core Text will be useful to anyone planning to take their paper-based publishing to a new digital level or to launch a new ePublishing business from scratch.
Why do we believe that Core Text is the most convenient and promising tool for electronic publishing on the iPad?
Reason 1: It offers great opportunities for working with text style
With Core Text's NSAttributedString object you can handle any type of text formatting, such as:
- changing font: its size, color and style (bold and italic)
- formatting paragraphs: setting up an indentation from the left and from the right, indentation of the first line, spacing before and after paragraphs
- changing background color
Core Text is capable of converting characters into glyphs, graphically representing a particular character.
For example, you can create the following glyphs of the “А” character:
Image source: Core Text Programming Guide by Apple
Reason 2: You can experiment with text layout and alignment
Core Text allows to wrap text around complex shapes:
You can even organize text into various shapes: a triangle, a circle, in columns, as well as more complex shapes.
Note for developers: To do this, the first step is to use the methods of CGMutablePathRef path = CGPathCreateMutable() object in order to create shape. You can find a list of methods here. Then, use a chosen path to create CTFrame object where you can directly input the text.
Reason 3: You can create multimedia content
Inserting audio and video elements into the page can be accomplished without damaging graphic quantity or data presentation speed.
Besides Core Text, the only other existing digital content presentation technology that allows adding multimedia elements to the page is WebView. However, we shouldn't forget that WebView essentially performs as a browser. Therefore, running several WebView elements is similar to running several mini-browsers, which can certainly influence the application's speed.
Reason 4: Core Text provides unique conditions for data entry and data processing
- Using Core Text for adding content is easy: text is entered directly into page, no need to use intermediate technologies. By contrast, working with WebView requires the use of HTML and CSS.
- Core Text ensures very high rendering speed, i.e. it quickly processes and displays text to the user. As of today, using Core Text is probably the quickest way of text rendering on iOS. Slow data processing speed and large content volume are the main disadvantages of using technologies like PDF and WebView, which are so popular today among electronic publishers. With Core Text, however, you will not turn users away with the size of your application.
- Since Core Text uses vector rendering, image quantity isn't compromised even when the image is enlarged significantly. This feature is especially valuable in cases when text contains charts and other graphical elements that need to be enlarged for detailed examination.
Note for developers: Core Text framework is a rather flexible environment for development, allowing to handle a variety of possible issues. For example, to ensure correct word hyphenation using Core Text, we recommend the algorithm of adding soft hyphens, developed by D. Knuth and F. Liang.
But of course, nothing is perfect. Core Text does have several disadvantages (a lack of features, to be precise). For example, Core Text doesn't provide functions for copying and selecting text. To solve the problem developers will have to come up with their own solution.
In conclusion, I’d like to note that beginning with iOS6, UITextView, UILabel, UIButton, UIPickerView, UITableViewCell, and UITextField classes support the NSAttributedString object, which means developers no longer have to rely on WebView elements for formatting text.
The Core Text technology provides a fast and convenient way for managing digital content. Core Text is perfect for developing news-related applications, where content needs to be updated and renewed frequently. In addition, Core Text will help effectively organize the process of publishing e-books, magazines, catalogs and other periodicals, allowing to format them in many ways.
If you have any questions about working with Core Text technology or dealing with issues concerning presentation of digital content on mobile devices, please contact us.