BuySellAds.com

Until Dec 3rd, 44% off all Manning books, including Barcodes with iOS! Promo code: mobicftw
Our DNA is written in Objective-C
Jump

DTCoreText 1.6.4

This update for DTCoreText brings fixes and improvements of equal proportion.

Changes

  • FIXED: Crash when having multiple font-families in the default style sheet
  • FIXED: Crash when encountering multiple font-families in one CSS style during parsing
  • FIXED: Specifying multi font-family entries does not find correct family if fall-back families are specified
  • FIXED: Race condition when using DTTextBlocks together with Tiled Layer
  • CHANGED: Removed CTParagraphStyle caching
  • ADDED: Workaround for rdar://14684188 (iOS 7)
  • ADDED: Adjust content inset in Demo for iOS 7
  • ADDED: Proper indenting of stacked text boxes
  • ADDED: Support for cascading CSS classes

The two things related to “multiple font-families” were bugs introduced in 1.6.3 through the much improved CSS style parsing. These bugs were still expecting the font-families to be a single string, whereas now they are returned as an array. I changed the checking logic accordingly and also added checking of the font-family names against the available font families to avoid skipping a perfectly valid font-family in favor of a fall-back like “sans-serif”.

I had to remove the caching of CTParagraphStyle instances because it would gobble up enormous amounts of memory and actually slow down parsing instead of helping as you’d expect a cache to do. Thanks to Konstantin Boukreev who built a benchmark and was able to convince me of the many benefits. Removing the caching also make DTCoreTextParagraphStyle way simpler.

The issue with DTTextBlocks came from an internal problem of Core Text. If you enumerate attributes inside a block that also enumerates attributes – and all of that on a background thread mandated by CATiledLayer – you can get weird crashes. I fixed that by completely rewriting the logic for drawing the text boxes. Now they are drawn from bottom to top.

Also, while being at it, I implemented proper support for having stacked text boxes indent each other:

Stacked Text Boxes

This is the result of having two DIVs with padding 10 px inside a DIV with padding 20 px.

This release’s MVP once again is Amro Mousa who made a last minute addition to this release. He added cascading support to the CSS support in DTCoreText. With this addition now the styles for multiple classes can be combined. Best if you look at his description of the pull request for an explanation.

1a9f7476-0625-11e3-8d68-b03ad71209a0

These are some new features, but since there where no API changes involved I opted to still keep this as a 1.6 version.

The new version is tagged on GitHab as well as available via CocoaPods.

Shout Outs

We like to mention great apps using DTCoreText.

Drag Pad ($1.99)

Drag Pad is a plain text and markdown editor for your iPhone and iPad.

screen568x568-3 Drag Pad using DTCore Text


Tagged as:

Categories: Updates

%d bloggers like this: