28th August 2017
The previous issue of DTCoreText was in February, 7 months ago, so it was time to release an update for the approx. 50 commitments made by social workers since then.
- ADDED: Support for
- ADDED: Support width attribute as a percentage for text attachment
- ADDED: Ability to cancel HTML parsing
- ADDED: Archiving
- ] ADDED: Enhanced MacOS Support
- FIXED: Incorrect file name in import should be DTCSSStylesheet.h
- FIXED: Multi-line HTML Generation
- FIXED: Do not Add ] Apple Converted Space To Assigned String When Handling Custom HTML Attributes
- FIXED: Ignore Non-String List Tones
- FIXED: Wrong Attributed Substance Passed to General Custom View Using Truncation
- FIXED: Avoid Unnecessary Drawing of DTAttributedTe xtContentView If It Is Awarded
- FIXED: Changing Properties of DTCoreTextLayoutFrame would not update the setup, resulting in claim that wrong size information was returned
I also went through the GitHub issues and closed all those who have not had any discussion for a long time. Most of them were questions that were long answered or are requests that no one is willing to implement.
There are two requests / questions that I would like to answer here:
- How about supporting synthetic italics for Chinese?
- How about supporting HTML tables?
iOS TextKit has no fonts to display Chinese glyphs in italics. The effect can be achieved by adding a slant transformation to the font. In fact, this has already been done in writing. Why this does not work for Chinese script is a mystery to me. I'm interested if someone can provide a solution via a pull request.
About HTML Tables … The problem here is that to support it, we need to do two major things: First, we need to analyze HTML tags related to tables (table, td, tr, etc.) in some temporary storage and then we have to build a text attachment from it. The second step would be to generate an image or a customized teaching that is capable of correct layout and reproduction of the table content.
In all years, I have never met anyone using DTCoreText who would be willing to pay me to implement it.
The maintenance update is marked on GitHub and also available through Cocoapods.
What about DTCoreText 2.0?
And really … there are other changes to DTCoreText that might happen before adding such new features, may reasonably be added. I'd rather start working with a sequel to DTCoreText 1
To name a few examples of different design choices for a new start:
- Today I will write it in Swift
- We could still use libxml to analyze HTML, but I would make it UIKit compatible exclusively.
- UILabel and UITextView supports assigned strings for many years now, there is simply no reason to continue using the assigned label from DTCoreText 1.x.
- The text attachment will only be modeled with NSTextAttachment, including support for asynchronous images.
- Via UITextView, we will also get automatic support for Rich Text editing. Instead of using DTRichTextEditor, editing will then be built into iOS and macOS.
- Unfortunately, Apple still does not support creating text lists, although IOS appears to support NSTextList and NSTextBlock internally. But we can probably hack around it in a way that is App Store-compatible.
- Using TextKit layout features, it will also be possible to get text flow around floating images
I have accumulated a lot of experience managing managed strings without using DTCoreText, solely depending on built-in functionality. And from that I can tell you that it is possible and worth the effort.
I would like a company that sponsors a new start. If you are interested in financing it, please contact.
Also published on Medium.