Is the future of eBooks RTF?

Displaying RTF (and RTFD) text in an app

With the advent of iOS 7 things are changing inside Apple's mobile operating system a good deal when it comes to the display of text. For example, you can now create an RTF file in TextEdit, style it with bold and itals, etc. on a Mac and even drop an image into that file. The display of that file is then possible with a trivial amount of code:

NSURL *rtfString = [[NSBundle mainBundle]
                         URLForResource: @"helloworld" withExtension:@"rtfd"];
NSAttributedString *stringWithRTFAttributes = [[NSAttributedString alloc]   initWithFileURL:rtfString options:@{NSDocumentTypeDocumentAttribute:NSRTFDTextDocumentType} documentAttributes:nil error:nil];
   
// Instantiate UITextView object
textView = [[UITextView alloc] initWithFrame:CGRectMake(20,20,self.view.frame.size.width,self.view.frame.size.height)];
   
textView.attributedText=stringWithRTFAttributes;
   
[self.view addSubview:textView];

Above is the entire code that needs to be entered in the whole app to display a single page of text with an image saved in RTFD format. But to create multiple pages that are automatically typeset and hyphenated is equally straightforward now as well thanks to NSLayoutManger and all the associated classes and methods that Apple has built into iOS 7 (see earlier posts, starting with this one).

Now that it is so simple to import RTF where is the sense in creating eBook readers using EPUB?

For simple books, RTF could well be a convenient approach, but you can equally import assets already styled in HTML using:

    'NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType'

instead of the above

    'NSDocumentTypeDocumentAttribute:NSRTFDTextDocumentType'

Whether this makes things harder or easier for EPUB app developers I'm not sure, but those who don't adopt the new approach will be left behind in terms of features and performance. And what I think this development is really about is encouraging all development towards use of Apple's core level text rendering rather than relying on content being displayed in a UIWebView - i.e. a browser window inside an ebook.

Conclusion

This move in iOS 7 will help Apple go beyond a 'good-enough' experience and to innovate in the area of text on mobile devices. Whether developers and publishers rely on RTF, HTML, EPUB or their own data structure, books are given a greater range of typographical freedom by Apple's additions and for this reason, despite fears of its impact on openness, it should be congratulated.

Endorse on Coderwall

Comments