<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cocoanetics &#187; DTCoreText</title>
	<atom:link href="http://www.cocoanetics.com/tag/dtcoretext/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cocoanetics.com</link>
	<description>Our DNA is written in Objective-C</description>
	<lastBuildDate>Sat, 25 May 2013 10:20:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F&amp;language=en_US&amp;category=text&amp;title=Cocoanetics&amp;description=Our+DNA+is+written+in+Objective-C&amp;tags=blog" type="text/html" />
		<item>
		<title>Rich Text Update 1.5</title>
		<link>http://www.cocoanetics.com/2013/05/rich-text-update-1-5/</link>
		<comments>http://www.cocoanetics.com/2013/05/rich-text-update-1-5/#comments</comments>
		<pubDate>Wed, 08 May 2013 16:22:41 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[DTCoreText]]></category>
		<category><![CDATA[DTLoupeView]]></category>
		<category><![CDATA[DTRichTextEditor]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8145</guid>
		<description><![CDATA[Today we are releasing the 1.5 version of our rich text components. This marks the second unified release where several parts of our rich text eco system are maturing in lock-step. For the most part these improvements and enhancements were funded from exceptional sales of DTRichTextEditor as well as several sponsors who stepped forward to allow me to finally get support for lists implemented. From what I can tell the clients who licensed the editor are way more willing to contribute funds to something they have already paid for, than for enhancing the &#8211; otherwise free with attribution &#8211; DTCoreText. Here are the collected release notes: DTRichTextEditor 1.5 ADDED: Implemented Support for Ordered and Unordered Lists, editable 1 level CHANGED: Improved handling of nested lists ADDED: Method to set text color for range ADDED: Method to set strikethrough style for range ADDED: HTMLStringWithOptions methods ADDED: Ability to animate between input views (custom keyboards) FIXED: style information would not obey custom CSS stylesheet in textDefaults CHANGED: editing delegate now uses editorView:shouldChangeTextInRange:replacementText: for image pasting ADDED: [DEMO] Formatting View Controller, shown as popover on iPad and input view on iPhone Online Documentation DTCoreText 1.5 ADDED: Methods for getting glyph path for glyph runs and lines CHANGED: DTTextAttachment is now a class cluster ADDED: Custom text attachments can now opt to participate in inline drawing and/or HTML output FIXED: Loading of font table made asynchronously FIXED: Fonts that have a synthetic slant matrix cause text to disappear FIXED: Shadow:none causes text to disappear FIXED: CSS Attributes were not case-sensitive FIXED: Issue with setting color of HR FIXED: Problems with nested list parsing and DTHTMLWriter output FIXED: HTTPS URLS in web video view where treated as external URLs FIXED: Bug where text attributes would &#8220;bleed&#8221; into the paragraph break Online Documentation DTLoupe 1.5 ADDED: sanity check to avoid rare NAN crash Online Documentation There is also now a Programming Guide for DTRichTextEditor where I&#8217;m collecting guides how to implement frequently asked about things. I especially would like to thank Lee Hericks for his work on the backend and help with polishing, as well as Daniel Phillips who helped implement the format picker in the Editor demo. Here&#8217;s a screenshot. &#160; Of course work has already begun on the next version. If you need something specific implemented please get in touch.]]></description>
				<content:encoded><![CDATA[<p>Today we are releasing the 1.5 version of our rich text components. This marks the second unified release where several parts of our rich text eco system are maturing in lock-step.</p>
<p>For the most part these improvements and enhancements were funded from exceptional sales of <a href="http://www.cocoanetics.com/parts/dtrichtexteditor/">DTRichTextEditor</a> as well as several sponsors who stepped forward to allow me to finally get <strong>support for lists</strong> implemented.</p>
<p>From what I can tell the clients who licensed the editor are way more willing to contribute funds to something they have already paid for, than for enhancing the &#8211; otherwise free with attribution &#8211; DTCoreText.</p>
<p><span id="more-8145"></span></p>
<div id="more-8145"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Here are the collected release notes:</p>
<h3>DTRichTextEditor 1.5</h3>
<ul>
<li>ADDED: Implemented Support for Ordered and Unordered Lists, editable 1 level</li>
<li>CHANGED: Improved handling of nested lists</li>
<li>ADDED: Method to set text color for range</li>
<li>ADDED: Method to set strikethrough style for range</li>
<li>ADDED: HTMLStringWithOptions methods</li>
<li>ADDED: Ability to animate between input views (custom keyboards)</li>
<li>FIXED: style information would not obey custom CSS stylesheet in textDefaults</li>
<li>CHANGED: editing delegate now uses editorView:shouldChangeTextInRange:replacementText: for image pasting</li>
<li>ADDED: [DEMO] Formatting View Controller, shown as popover on iPad and input view on iPhone</li>
</ul>
<p><a href="https://docs.cocoanetics.com/DTRichTextEditor/">Online Documentation</a></p>
<h3>DTCoreText 1.5</h3>
<ul>
<li>ADDED: Methods for getting glyph path for glyph runs and lines</li>
<li>CHANGED: DTTextAttachment is now a class cluster</li>
<li>ADDED: Custom text attachments can now opt to participate in inline drawing and/or HTML output</li>
<li>FIXED: Loading of font table made asynchronously</li>
<li>FIXED: Fonts that have a synthetic slant matrix cause text to disappear</li>
<li>FIXED: Shadow:none causes text to disappear</li>
<li>FIXED: CSS Attributes were not case-sensitive</li>
<li>FIXED: Issue with setting color of HR</li>
<li>FIXED: Problems with nested list parsing and DTHTMLWriter output</li>
<li>FIXED: HTTPS URLS in web video view where treated as external URLs</li>
<li>FIXED: Bug where text attributes would &#8220;bleed&#8221; into the paragraph break</li>
</ul>
<p><a href="https://docs.cocoanetics.com/DTCoreText/">Online Documentation</a></p>
<h3>DTLoupe 1.5</h3>
<ul>
<li>ADDED: sanity check to avoid rare NAN crash</li>
</ul>
<p><a href="https://docs.cocoanetics.com/DTLoupeView/">Online Documentation</a></p>
<p>There is also now a <a href="https://docs.cocoanetics.com/DTRichTextEditor/docs/Programming%20Guide.html">Programming Guide for DTRichTextEditor</a> where I&#8217;m collecting guides how to implement frequently asked about things.</p>
<p>I especially would like to thank <strong>Lee Hericks</strong> for his work on the backend and help with polishing, as well as <a href="http://twitter.com/Daniel_J_P">Daniel Phillips</a> who helped implement the format picker in the Editor demo. Here&#8217;s a screenshot.</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-08-at-18.04.29.png"><img class="alignnone  wp-image-8146" alt="DTRichTextEditor 1.5" src="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-08-at-18.04.29.png?resize=622%2C819" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>Of course work has already begun on the next version. If you need something specific implemented please <a href="mailto:oliver@cocoanetics.com">get in touch</a>.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8145&amp;md5=b1da5aec26aa5de61595157ccfce438e" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/rich-text-update-1-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Frich-text-update-1-5%2F&amp;language=en_GB&amp;category=text&amp;title=Rich+Text+Update+1.5&amp;description=Today+we+are+releasing+the+1.5+version+of+our+rich+text+components.+This+marks+the+second+unified+release+where+several+parts+of+our+rich+text+eco+system+are+maturing+in...&amp;tags=DTCoreText%2CDTLoupeView%2CDTRichTextEditor%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Rich Text Update 1.4</title>
		<link>http://www.cocoanetics.com/2013/04/rich-text-update-1-4/</link>
		<comments>http://www.cocoanetics.com/2013/04/rich-text-update-1-4/#comments</comments>
		<pubDate>Fri, 05 Apr 2013 17:22:26 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[DTCoreText]]></category>
		<category><![CDATA[DTRichTextEditor]]></category>

		<guid isPermaLink="false">https://www.cocoanetics.com/?p=7979</guid>
		<description><![CDATA[Beginning with version 1.4 we will advance the version tags on DTCoreText and DTRichTextEditor in sync. DTCoreText is in charge of HTML parsing, display and HTML generation inside the editor component and thus all the changes done there are indirectly benefitting editor users as well. I&#8217;ve begun to aggregate issues on both GitHub and our own private GitLab instance via milestones. These are the grouping unit collecting issues so that you can tell from which version onward these fixes or enhancements are available. Each milestone will become a tag, once it is completed and will represent a stable version. You can always get a picture of the original issues if you filter them by milestone, like in this GitHub issue list for version 1.4.0 of DTCoreText DTCoreText 1.4 Changes ADDED: Support for including local CSS style sheet files ADDED: DTHTMLWriter can now write HTML fragments with inline styles CHANGED: Changed the way color-changing hyperlinks are drawn, code now unified in DTCoreTextLayoutFrame CHANGED: You no longer need an override plist, all available system fonts now get loaded into the override table automatically CHANGED: renamed the define for showing performance measurement so that they don&#8217;t show in normal DEBUG mode CHANGED: strike-through and underline is now properly positioned and sized FIXED: Dictation Placeholder not displayed if no text delegate set FIXED: Line truncation problem going for longer than the paragraph FIXED: RTL justified text too short to be justified would be left-aligned instead of being right-aligned FIXED: Problem parsing CSS styles containing a !important tag FIXED: Using Chinese characters would cause height problems in hyperlinks FIXED: Having text with a shadow would cause bolder text due to it being drawn twice FIXED: Images don&#8217;t keep aspect ratio on resize FIXED: Element hyperlink URL did not get copied to DTTextAttachment FIXED: code removed by accident would cause problem with custom views for links FIXED: HTML encoding for Emoji Characters FIXED: Static Framework was not linking in code from DTFoundation FIXED: Static Framework building was missing embedded DTHTMLParser The changes to how hyperlinks are drawn are breaking the API since before the color changing of hyperlinks that are touched was done inside DTLinkButton. But it was next to impossible to have these line up perfectly with the text. Now there is a mode on drawing (via bit mask) that allows you to draw a frame either with normal or highlighted hyperlinks. The second big noticeable improvement relates to underlining. UIWebViews only do a nasty 1 px underline regardless of font size. The new method gets the line thickness and position from the CTFont. This causes underlines to look like in Pages. Also a great deal of effort was spent on having the lines always perfect pixel aligned, even on Retina displays. DTRichTextEditor 1.4 Changes ADDED: A delegation protocol that gives it feature parity with UITextView. FIXED: override typing attributes (like setting bold with no selection) would be reset on a new line FIXED: Autocorrection was broken due to removal of input delegate notification UPDATED: DTCoreText to 1.4 At the time of this writing this version was not finalized and bug fixing still underway. But those are just finishing touches. The other big and important improvement is that now the code lives on a GitLab server instead of Subversion. This unifies our workflow tremendously since we no longer have to keep copies of sub-projects inside the SVN repo. Instead everything is included as git submodules. Those are always pointing to an exact commit in the submodule. This way we have control over which version of the submodule we want to use and can advance the pointer if there is a new release without having to keep updating a full copy of the source code. The other big advantage for all our clients comes from everybody having their own git user accounts. This way you can easily contribute enhancements in a project branch and create a merge request for them to be included in the master branch. Previously on Subversion I only had a single read-only user for everybody. I am hoping that the new structure and the help of fabulous GitLab will enable a new form of social coding that we see as standard on GitHub. And that seeing other users helping out and squashing bugs will inspire a greater belief in the quality of this component as well as inspire contributing for the greater good. The next version will finally implement proper list support. Two people have stepped forward to fund the development of this feature. This is a somewhat involved thing since we need to implement ability to protect certain parts of the text. You don&#8217;t want the user to be able to remove individual characters of a list item prefix. This can also benefit people who want to treat hyperlinks as a [...]]]></description>
				<content:encoded><![CDATA[<p>Beginning with version 1.4 we will advance the version tags on DTCoreText and DTRichTextEditor in sync. DTCoreText is in charge of HTML parsing, display and HTML generation inside the editor component and thus all the changes done there are indirectly benefitting editor users as well.</p>
<p>I&#8217;ve begun to aggregate issues on both GitHub and our own private GitLab instance via milestones. These are the grouping unit collecting issues so that you can tell from which version onward these fixes or enhancements are available. Each milestone will become a tag, once it is completed and will represent a stable version.</p>
<p><span id="more-7979"></span></p>
<div id="more-7979"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>You can always get a picture of the original issues if you filter them by milestone, like in this GitHub issue list for <a href="https://github.com/Cocoanetics/DTCoreText/issues?milestone=1&amp;state=closed">version 1.4.0 of DTCoreText</a></p>
<h3>DTCoreText 1.4 Changes</h3>
<ul>
<li>ADDED: Support for including local CSS style sheet files</li>
<li>ADDED: DTHTMLWriter can now write HTML fragments with inline styles</li>
<li>CHANGED: Changed the way color-changing hyperlinks are drawn, code now unified in DTCoreTextLayoutFrame</li>
<li>CHANGED: You no longer need an override plist, all available system fonts now get loaded into the override table automatically</li>
<li>CHANGED: renamed the define for showing performance measurement so that they don&#8217;t show in normal DEBUG mode</li>
<li>CHANGED: strike-through and underline is now properly positioned and sized</li>
<li><span style="line-height: 13px;">FIXED: Dictation Placeholder not displayed if no text delegate set</span></li>
<li>FIXED: Line truncation problem going for longer than the paragraph</li>
<li>FIXED: RTL justified text too short to be justified would be left-aligned instead of being right-aligned</li>
<li>FIXED: Problem parsing CSS styles containing a !important tag</li>
<li>FIXED: Using Chinese characters would cause height problems in hyperlinks</li>
<li>FIXED: Having text with a shadow would cause bolder text due to it being drawn twice</li>
<li>FIXED: Images don&#8217;t keep aspect ratio on resize</li>
<li>FIXED: Element hyperlink URL did not get copied to DTTextAttachment</li>
<li>FIXED: code removed by accident would cause problem with custom views for links</li>
<li>FIXED: HTML encoding for Emoji Characters</li>
<li>FIXED: Static Framework was not linking in code from DTFoundation</li>
<li>FIXED: Static Framework building was missing embedded DTHTMLParser</li>
</ul>
<p>The changes to how hyperlinks are drawn are breaking the API since before the color changing of hyperlinks that are touched was done inside DTLinkButton. But it was next to impossible to have these line up perfectly with the text. Now there is a mode on drawing (via bit mask) that allows you to draw a frame either with normal or highlighted hyperlinks.</p>
<p>The second big noticeable improvement relates to underlining. UIWebViews only do a nasty 1 px underline regardless of font size. The new method gets the line thickness and position from the CTFont. This causes underlines to look like in Pages. Also a great deal of effort was spent on having the lines always perfect pixel aligned, even on Retina displays.</p>
<h3>DTRichTextEditor 1.4 Changes</h3>
<ul>
<li><span style="line-height: 13px;">ADDED: A delegation protocol that gives it feature parity with UITextView.</span></li>
<li>FIXED: override typing attributes (like setting bold with no selection) would be reset on a new line</li>
<li>FIXED: Autocorrection was broken due to removal of input delegate notification</li>
<li>UPDATED: DTCoreText to 1.4</li>
</ul>
<p>At the time of this writing this version was not finalized and bug fixing still underway. But those are just finishing touches.</p>
<p>The other big and important improvement is that now the code lives on a GitLab server instead of Subversion. This unifies our workflow tremendously since we no longer have to keep copies of sub-projects inside the SVN repo. Instead everything is included as git submodules. Those are always pointing to an exact commit in the submodule. This way we have control over which version of the submodule we want to use and can advance the pointer if there is a new release without having to keep updating a full copy of the source code.</p>
<p>The other big advantage for all our clients comes from everybody having their own git user accounts. This way you can easily contribute enhancements in a project branch and create a merge request for them to be included in the master branch. Previously on Subversion I only had a single read-only user for everybody.</p>
<p>I am hoping that the new structure and the help of fabulous GitLab will enable a new form of social coding that we see as standard on GitHub. And that seeing other users helping out and squashing bugs will inspire a greater belief in the quality of this component as well as inspire contributing for the greater good.</p>
<p>The next version will finally implement proper list support. Two people have stepped forward to fund the development of this feature. This is a somewhat involved thing since we need to implement ability to protect certain parts of the text. You don&#8217;t want the user to be able to remove individual characters of a list item prefix. This can also benefit people who want to treat hyperlinks as a single unit.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=7979&amp;md5=df5df9b1404f4f9b642b3164ea3a3625" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/04/rich-text-update-1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F04%2Frich-text-update-1-4%2F&amp;language=en_GB&amp;category=text&amp;title=Rich+Text+Update+1.4&amp;description=Beginning+with+version+1.4+we+will+advance+the+version+tags+on+DTCoreText+and+DTRichTextEditor+in+sync.+DTCoreText+is+in+charge+of+HTML+parsing%2C+display+and+HTML+generation+inside+the+editor...&amp;tags=DTCoreText%2CDTRichTextEditor%2Cblog" type="text/html" />
	</item>
		<item>
		<title>DTCoreText 1.2.0</title>
		<link>http://www.cocoanetics.com/2013/01/dtcoretext-1-2-0/</link>
		<comments>http://www.cocoanetics.com/2013/01/dtcoretext-1-2-0/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 10:46:16 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[DTCoreText]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=7496</guid>
		<description><![CDATA[Funny Story: right after I published my findings on how to work CocoaPods I received a couple of pull requests. Should it be actually be the case that fellow developers are beginning to take notice of DTCoreText? I admit, that for the first few tags/versions of DTCoreText I didn&#8217;t take CocoaPods seriously. But since I got down how to work with sub-modules and sub-specs I find that it gives me a great deal of pleasure to keep my specs current. As your software matures people want to use a stable version of your library. That&#8217;s what versioning is for. From now on, any new features will increase the minor version digit. Fixes and improvements of existing functionality will increase the third digit. Changes ADDED: truncation support to DTCoreTextLayoutFrame ADDED: DTAttributedLabel which can be used as a UILabel replacement FIXED: GCD ARC errors and warnings with iOS 6 deployment target CHANGED: DTAttributedTextView now uses the underlying UIScrollView contentInset CHANGED: Improvements on DTAttributedTextView to prevent unnecessary re-layouting Many thanks go especially to bkennyatmeetme who contributed the first 2 items. The new version is on CocoaPods and you should get it by pod update. We are thankful for any kind of support that you are willing to offer for our fun project here. You can use DTCoreText in your apps for free if you attribute it to Cocoanetics, or you can purchase a Non-Attribution License for 75 Euros in our Parts Store. This is basically the DTCoreText improvement fund, but you get an invoice for your contribution that you can use in your company. We are also looking for sponsors for larger endeavors like for example implementing support for &#60;table&#62; tags or further improve CSS support. Don&#8217;t hesitate to get in touch.]]></description>
				<content:encoded><![CDATA[<p>Funny Story: right after I published my findings on <a title="Digging into CocoaPods" href="http://www.cocoanetics.com/2013/01/digging-into-cocoapods/">how to work CocoaPods</a> I received a couple of pull requests. Should it be actually be the case that fellow developers are beginning to take notice of DTCoreText?</p>
<p>I admit, that for the first few tags/versions of DTCoreText I didn&#8217;t take CocoaPods seriously. But since I got down how to work with sub-modules and sub-specs I find that it gives me a great deal of pleasure to keep my specs current.</p>
<p><span id="more-7496"></span></p>
<div id="more-7496"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>As your software matures people want to use a stable version of your library. That&#8217;s what versioning is for. From now on, any new features will increase the minor version digit. Fixes and improvements of existing functionality will increase the third digit.</p>
<h3>Changes</h3>
<ul>
<li>ADDED: <strong>truncation support</strong> to DTCoreTextLayoutFrame</li>
<li>ADDED: <strong>DTAttributedLabel</strong> which can be used as a UILabel replacement</li>
<li>FIXED: <a title="OMG, GCD+ARC" href="http://www.cocoanetics.com/2013/01/omg-gcdarc/">GCD ARC errors and warnings</a> with iOS 6 deployment target</li>
<li>CHANGED: <strong>DTAttributedTextView</strong> now uses the underlying UIScrollView contentInset</li>
<li>CHANGED: Improvements on DTAttributedTextView to prevent unnecessary re-layouting</li>
</ul>
<p>Many thanks go especially to <a href="https://github.com/bkennyatmeetme">bkennyatmeetme</a> who contributed the first 2 items.</p>
<p>The new version is on CocoaPods and you should get it by pod update. We are thankful for any kind of support that you are willing to offer for our fun project here.</p>
<p>You can use DTCoreText in your apps for free if you attribute it to Cocoanetics, or you can purchase a <a href="http://www.cocoanetics.com/order/?product=DTCoreText%20Non-Attribution%20License">Non-Attribution License for 75 Euros</a> in our Parts Store. This is basically the DTCoreText improvement fund, but you get an invoice for your contribution that you can use in your company.</p>
<p>We are also <strong>looking for sponsors</strong> for larger endeavors like for example implementing support for &lt;table&gt; tags or further improve CSS support. Don&#8217;t hesitate to get in touch.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=7496&amp;md5=51ba18193b9b6513ae69d68df6067f95" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/01/dtcoretext-1-2-0/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F01%2Fdtcoretext-1-2-0%2F&amp;language=en_GB&amp;category=text&amp;title=DTCoreText+1.2.0&amp;description=Funny+Story%3A+right+after+I+published+my+findings+on+how+to+work+CocoaPods%C2%A0I+received+a+couple+of+pull+requests.+Should+it+be+actually+be+the+case+that+fellow+developers+are...&amp;tags=DTCoreText%2Cblog" type="text/html" />
	</item>
		<item>
		<title>DTCoreText 1.1</title>
		<link>http://www.cocoanetics.com/2012/12/dtcoretext-1-1/</link>
		<comments>http://www.cocoanetics.com/2012/12/dtcoretext-1-1/#comments</comments>
		<pubDate>Sun, 30 Dec 2012 17:11:03 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[DTCoreText]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=7402</guid>
		<description><![CDATA[Other people take off the Christmas holidays to have fun. I delight in using the time away from normal programming work to work on DTCoreText. There are many wide-reaching changes to warrant an increase in version number on the second digit. I need to sum them up in this location because you might have projects that rely on DTCoreText for displaying attributed strings. Version 1.1. marks the second major improvement related to parsing HTML. The first step was to replace NSScanner with libxml2. The approach there was to keep track of a sort of DOM fragment comprised of DTHTMLElements. The actual text would be tracked separately and at certain locations the current text would be put into the current element and appended to the building string. The problem with the previous approach was that it caused the code to be extremely convoluted because I needed to keep track of a multitude of parameters: whether the previous string had whitespace at the end, whether the next string fragment would require a newline before being flushed because it belonged to a block-level element and much more. DOM-inating The new parsing approach greatly simplifies the code inside DTHTMLAttributedStringBuilder, both in the DTHTMLParser delegate callbacks as well as the blocks to be executed for beginning and ending of tags. DTHTMLElement is now itself a subclass of DTHTMLParserNode. This represents a node in the parse tree which a name, attributes and child nodes. Because this approach constructs an actual Document Object Model (DOM) of the HTML document you can output a HTML-like structure similar to how Safari shows the structure of an inspected document. &#160; This output works because DTHTMLParserNode provides a debugDescription method which constructs this properly indented display. The default mode of DTHTMLAttributedStringBuilder is to discard child nodes that it does not need any more, but you can have the structure be preserved and output it at any stage during or after the build process. The _rootNode IVAR points to the root node of the document, the _bodyElement points to the tag representing the &#60;body&#62; tag. libxml2 always adds a body tag even if the parsed HTML did not have one. It does an exceptionally good job in making the HTML well-formed. Must be from its XML parsing heritage. Class-Cluster Polymorphism This new approach to a DOM tree allowed me to remove all these crufty state IVARs and a few specialized methods from the begin and end tag handlers. Those are blocks that get called after a new node is opened or closed by libxml2. Instead there are now multiple subclasses of DTHTMLElement which provide specialized behavior for several HTML tags. One such HTML element primarily provides an attributedString method that returns a representation of said element as NSAttributedString. The base class provides an extensive implementation that also walks through its children. But for an &#60;img&#62; tag we don&#8217;t care about these anyway, so the overwritten version of attributedString does not need to iterate over the child nodes. This method is what they call a &#8220;class cluster&#8221; and I got the inspiration for it from UIButton. You might remember that UIButton does not have an alloc/init but rather you instantiate buttonWithType:. The reason for this is that you never actually get a UIButton, but each of these types returns a specialized UIButton subclass. Same with DTHTMLElement, there the tag name is used to look up the class to be used for the initializiation. + &#40;void&#41;initialize &#123; // lookup table so that we quickly get the correct class to instantiate for special tags NSMutableDictionary *tmpDict = &#91;&#91;NSMutableDictionary alloc&#93; init&#93;; &#160; &#91;tmpDict setObject:&#91;DTHTMLElementBR class&#93; forKey:@&#34;br&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementHR class&#93; forKey:@&#34;hr&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementLI class&#93; forKey:@&#34;li&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementStylesheet class&#93; forKey:@&#34;style&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementAttachment class&#93; forKey:@&#34;img&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementAttachment class&#93; forKey:@&#34;object&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementAttachment class&#93; forKey:@&#34;video&#34;&#93;; &#91;tmpDict setObject:&#91;DTHTMLElementAttachment class&#93; forKey:@&#34;iframe&#34;&#93;; &#160; _classesForNames = &#91;tmpDict copy&#93;; &#125; &#160; + &#40;DTHTMLElement *&#41;elementWithName:&#40;NSString *&#41;name attributes:&#40;NSDictionary *&#41;attributes options:&#40;NSDictionary *&#41;options &#123; // look for specialized class Class class = &#91;_classesForNames objectForKey:name&#93;; &#160; // use generic of none found if &#40;!class&#41; &#123; class = &#91;DTHTMLElement class&#93;; &#125; &#160; DTHTMLElement *element = &#91;&#91;class alloc&#93; initWithName:name attributes:attributes options:options&#93;; &#160; return element; &#125; Since all these subclasses derive from DTHTMLElement I can treat them as such whenever I am iterating over them. Each provides an attributedString method, however specialized it might be. This polymorphism should give a further performance improvement because there is never a need for giant &#8220;if trees&#8221;. The only remaining items in the tag start/end handling blocks are related to special CSS style cases that are difficult to model with the current brute for CSS selector methodology. For example setting the headerLevel property to 1 for a &#60;h1&#62;. Of course I could make a special H1 DTHTMLElement subclass or maybe even one for all headers. One exception to this rule is the block that deals with a &#60;style&#62; block. [...]]]></description>
				<content:encoded><![CDATA[<p>Other people take off the Christmas holidays to have fun. I delight in using the time away from normal programming work to work on DTCoreText.</p>
<p>There are many wide-reaching changes to warrant an increase in version number on the second digit. I need to sum them up in this location because you might have projects that rely on DTCoreText for displaying attributed strings.</p>
<p><span id="more-7402"></span></p>
<div id="more-7402"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Version 1.1. marks the second major improvement related to parsing HTML. The first step was to replace NSScanner with libxml2. The approach there was to keep track of a sort of DOM fragment comprised of DTHTMLElements. The actual text would be tracked separately and at certain locations the current text would be put into the current element and appended to the building string.</p>
<p>The problem with the previous approach was that it caused the code to be extremely convoluted because I needed to keep track of a multitude of parameters: whether the previous string had whitespace at the end, whether the next string fragment would require a newline before being flushed because it belonged to a block-level element and much more.</p>
<h3>DOM-inating</h3>
<p>The new parsing approach greatly simplifies the code inside DTHTMLAttributedStringBuilder, both in the DTHTMLParser delegate callbacks as well as the blocks to be executed for beginning and ending of tags. DTHTMLElement is now itself a subclass of DTHTMLParserNode. This represents a node in the parse tree which a name, attributes and child nodes.</p>
<p>Because this approach constructs an actual Document Object Model (DOM) of the HTML document you can output a HTML-like structure similar to how Safari shows the structure of an inspected document.</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2012-12-30-at-17.24.36.png"><img class="alignnone size-full wp-image-7403" alt="DOM structure" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2012-12-30-at-17.24.36.png?resize=465%2C307" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>This output works because DTHTMLParserNode provides a debugDescription method which constructs this properly indented display.</p>
<p>The default mode of DTHTMLAttributedStringBuilder is to discard child nodes that it does not need any more, but you can have the structure be preserved and output it at any stage during or after the build process. The _rootNode IVAR points to the root node of the document, the _bodyElement points to the tag representing the &lt;body&gt; tag.</p>
<p>libxml2 always adds a body tag even if the parsed HTML did not have one. It does an exceptionally good job in making the HTML well-formed. Must be from its XML parsing heritage.</p>
<h3>Class-Cluster Polymorphism</h3>
<p>This new approach to a DOM tree allowed me to remove all these crufty state IVARs and a few specialized methods from the begin and end tag handlers. Those are blocks that get called after a new node is opened or closed by libxml2.</p>
<p>Instead there are now multiple subclasses of DTHTMLElement which provide specialized behavior for several HTML tags. One such HTML element primarily provides an attributedString method that returns a representation of said element as NSAttributedString. The base class provides an extensive implementation that also walks through its children. But for an &lt;img&gt; tag we don&#8217;t care about these anyway, so the overwritten version of attributedString does not need to iterate over the child nodes.</p>
<p>This method is what they call a &#8220;class cluster&#8221; and I got the inspiration for it from UIButton. You might remember that UIButton does not have an alloc/init but rather you instantiate buttonWithType:. The reason for this is that you never actually get a UIButton, but each of these types returns a specialized UIButton subclass.</p>
<p>Same with DTHTMLElement, there the tag name is used to look up the class to be used for the initializiation.</p>

<div class="wp_codebox"><table><tr id="p74022"><td class="code" id="p7402code2"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>initialize
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// lookup table so that we quickly get the correct class to instantiate for special tags</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">*</span>tmpDict <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementBR class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;br&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementHR class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;hr&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementLI class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;li&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementStylesheet class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;style&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementAttachment class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;img&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementAttachment class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;object&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementAttachment class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;video&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tmpDict setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DTHTMLElementAttachment class<span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;iframe&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	_classesForNames <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tmpDict copy<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>DTHTMLElement <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>elementWithName<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>name attributes<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>attributes options<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>options
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// look for specialized class</span>
	<span style="color: #a61390;">Class</span> class <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>_classesForNames objectForKey<span style="color: #002200;">:</span>name<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// use generic of none found</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>class<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		class <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>DTHTMLElement class<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	DTHTMLElement <span style="color: #002200;">*</span>element <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>class alloc<span style="color: #002200;">&#93;</span> initWithName<span style="color: #002200;">:</span>name attributes<span style="color: #002200;">:</span>attributes options<span style="color: #002200;">:</span>options<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">return</span> element;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>Since all these subclasses derive from DTHTMLElement I can treat them as such whenever I am iterating over them. Each provides an attributedString method, however specialized it might be. This polymorphism should give a further performance improvement because there is never a need for giant &#8220;if trees&#8221;.</p>
<p>The only remaining items in the tag start/end handling blocks are related to special CSS style cases that are difficult to model with the current brute for CSS selector methodology. For example setting the headerLevel property to 1 for a &lt;h1&gt;. Of course I could make a special H1 DTHTMLElement subclass or maybe even one for all headers.</p>
<p>One exception to this rule is the block that deals with a &lt;style&gt; block. Version 1.0 of DTCoreText has a bug where only the first part of a lengthly style sheet is actually being parsed. Simply for the reason that I never thought that libxml2 would send multiple CData callbacks for longer blocks.</p>
<p>In the previous version HTML created from attributed strings would attach the style information to the individual tags. Inspired by Apple&#8217;s NSHTMLWriter I created DTHTMLWriter and I&#8217;m also aggregating styles into classes per tag. Naturally this increases the size of such a style block enough for the above mentioned problem to manifest.</p>
<p>This is a case where a state in the string builder class needs to be modified because of the contents of the stylesheet and so the logical place is in the handler block.</p>
<h3>Oh, and some bug fixes, too!</h3>
<p>First there was the problem with the long style blocks. That&#8217;s working now.</p>
<p>Actually the motivation for this weeks worth of changes came from an open issue. The problem was that if you had two underline words then the space between them would also get underlined. This was quite hard to fix in the old parse style because of the detachment of text and formatting information. This is fixed now.</p>
<p>There was a bug in DTLinkButton that would manifest if you were using highlighting on tapping on links. The assumption was that there could only ever be one glyph run and so only the first one got displayed there. The bug resulting from this was that hyperlinks consisting of multiple Chinese characters would consist of multiple glyph runs of which all but the first would not be displayed. Fixed.</p>
<p>There was also a second problem with DTLinkButton that would only show for very small fonts. This button has a feature to make itself grow in size if the hit area became to small for normal fingers. This caused small text to shift to the left side. Fixed.</p>
<p>Then there was a problem with dealing with pt versus px as length measurement. Previously I had treated them as equivalent but it turns out that apparently 1 point should be 1.3333 px. Because of this HTML that specified font sizes as pt would make the text appear too small. Fixed.</p>
<h3>Conclusion</h3>
<p>I was too lazy to to a benchmark comparison between both versions, but my guess is that the new method should be faster. Maybe somebody can verify this by timing it.</p>
<p>I&#8217;m hoping that the source code in this new version is so much more simple to understand that more people can contribute to the project. For example now that the entire tree of a &lt;table&gt; tag exists one could implement a simple form of table support.</p>
<p>Just two days ago it didn&#8217;t look to me like I could bring this development branch to 100% coverage of the unit tests, but I endured and finally I got all test cases to pass, including a few new ones. This should mean that the results should be identical or better than what version 1.0 was generating.</p>
<p>Your feedback cordially invited.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=7402&amp;md5=697c659839e0185a47e174fcd0a37b3f" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2012/12/dtcoretext-1-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2012%2F12%2Fdtcoretext-1-1%2F&amp;language=en_GB&amp;category=text&amp;title=DTCoreText+1.1&amp;description=Other+people+take+off+the+Christmas+holidays+to+have+fun.+I+delight+in+using+the+time+away+from+normal+programming+work+to+work+on+DTCoreText.+There+are+many+wide-reaching+changes...&amp;tags=DTCoreText%2Cblog" type="text/html" />
	</item>
		<item>
		<title>DTCoreText 1.0.1, Linker Flags and Rich Text News</title>
		<link>http://www.cocoanetics.com/2012/04/dtcoretext-1-0-1-linker-flags-and-rich-text-news/</link>
		<comments>http://www.cocoanetics.com/2012/04/dtcoretext-1-0-1-linker-flags-and-rich-text-news/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 09:08:24 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[DTCoreText]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=6255</guid>
		<description><![CDATA[I reported a while ago that I was forced to tag the current state of the DTCoreText master repository as 1.0.0. The reason for this was that CocoaPods was starting to gain lots of momentum and several people wanted to use DTCoreText via a podspec. You can have podspecs point to the master branch as well, but then you never really know what you get. This can possibly cause many headaches especially in larger projects where you cannot track the state of each individual sub-project. Therefore it is generally recommended &#8211; if not required &#8211; to make use of tags in GitHub. Tags are like labels that you attach to the current state of a repository. You can create them simply by issuing the following command in the repository root folder. git tag &#34;1.0.1&#34; You can list the existing tags with: git tag -l There is an option on git push to have the tags also travel to the origin repository on GitHub: git push origin master --tags Once you&#8217;ve done that, GitHub provides snapshots of the tagged state as tar balls and zip files&#8230; though you probably don&#8217;t want to use these but rather have the project as a clone so that you can easily update it. DTCoreText News Amongst the fixes that made this maintenance release necessary where: Fixed Block-Retain-Cycle Fixed a second minor retain-cycle Workaround for Chinese Font cascade bug in iOS 5.x (radar://11262229) Workaround for a CoreText memory leak in iOS 4.3 (fixed in 5.0) Some Unit Testing corrections Updated Readme regarding necessary linker flags I finally got around to also filing a Radar for the cascade bug. The memory leak issue is fixed as of iOS 5, the problem there was that if you replaced the paragraph style attribute on an NSAttributedString with a new one, the previous entry would leak. I fixed that by simply removing the attribute first before calling addAttribute with the new style. The project has surpassed 1000 watchers on GitHub which tells me that it is definitely of use for many people. If you have any app making use of it, then please tell me about it as I like to feature your work. I especially love to receive testimonials like this one. The changes to the Readme reflect the outcome of research done by David Hoerl. The question was to determine which linker flags are really necessary when linking in DTCoreText &#8211; or any other static library that contains categories &#8211; into an app. Linker Flags Wisdom The linker in general tries to only link in code that is actually used. So if you have C-functions then their code will not end up in the final app binary if it is never being called. This does not work for Objective-C category extensions because of the dynamic nature of method resolution. Therefore you would generally use the -ObjC linker flag when dealing with static libraries that contain Objective-C code. Greg Parker from Apple who refers to himself as &#8220;Runtime Wrangler&#8221; explains it like this: -all_load and -force_load act at link time, not at load time. -all_load and -force_load tell the linker to link the entire static archive in the final executable, even if the linker thinks that parts of the archive are unused. When you link a traditional C static archive (.a file), any code from the archive that is never referenced in the final executable is simply omitted from the executable. So if you had a static archive with 999 functions you did not call and 1 function that you did call, your final executable would include only that one function. Objective-C categories break the C static archive model, because you want the Objective-C category to appear in the final executable even though there are no C symbol references to it from the executable. The best solution for Objective-C categories in static archives is the -ObjC linker option, which tells the linker that all Objective-C categories in the archives are &#8220;used&#8221; but to apply the usual reference algorithm for everything else in the archives. The -ObjC option is broken in some versions of the linker. For those cases the -force_load and -all_load options work. The final executable may be larger than necessary with those options, if there were classes or C functions that could have been omitted by the linker. If you have multiple archives and only some of them have Objective-C code then -force_load may generate smaller output than -all_load. On iOS you&#8217;d typically only link in libraries that you need, as opposed to traditional C or C++ where you&#8217;d often link in large static libraries that are collections of utility methods. So in the case where the libDTCoreText.a is the only static library should be  no difference between force_load and all_load at all. Personally I prefer the simplest [...]]]></description>
				<content:encoded><![CDATA[<p>I reported a while ago that I was forced to tag the current state of the DTCoreText master repository as <a title="DTRichTextEditor / DTCoreText News" href="http://www.cocoanetics.com/2012/02/dtrichtexteditor-dtcoretext-news/">1.0.0</a>. The reason for this was that CocoaPods was starting to gain lots of momentum and several people wanted to use DTCoreText via a podspec.</p>
<p>You can have podspecs point to the master branch as well, but then you never really know what you get. This can possibly cause many headaches especially in larger projects where you cannot track the state of each individual sub-project.</p>
<p>Therefore it is generally recommended &#8211; if not required &#8211; to make use of tags in GitHub.</p>
<p><span id="more-6255"></span></p>
<div id="more-6255"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Tags are like labels that you attach to the current state of a repository. You can create them simply by issuing the following command in the repository root folder.</p>

<div class="wp_codebox"><table><tr id="p62557"><td class="code" id="p6255code7"><pre class="objc" style="font-family:monospace;">git tag <span style="color: #bf1d1a;">&quot;1.0.1&quot;</span></pre></td></tr></table></div>

<p>You can list the existing tags with:</p>

<div class="wp_codebox"><table><tr id="p62558"><td class="code" id="p6255code8"><pre class="objc" style="font-family:monospace;">git tag <span style="color: #002200;">-</span>l</pre></td></tr></table></div>

<p>There is an option on git push to have the tags also travel to the origin repository on GitHub:</p>

<div class="wp_codebox"><table><tr id="p62559"><td class="code" id="p6255code9"><pre class="objc" style="font-family:monospace;">git push origin master <span style="color: #002200;">--</span>tags</pre></td></tr></table></div>

<p>Once you&#8217;ve done that, GitHub provides snapshots of the tagged state as tar balls and zip files&#8230; though you probably don&#8217;t want to use these but rather have the project as a clone so that you can easily update it.</p>
<p><a href="http://i2.wp.com/www.cocoanetics.com/files/Bildschirmfoto-2012-04-17-um-9.59.15-AM.png"><img class="alignnone size-full wp-image-6256" title="Tags on GitHub" src="http://i2.wp.com/www.cocoanetics.com/files/Bildschirmfoto-2012-04-17-um-9.59.15-AM.png?resize=341%2C371" alt="" data-recalc-dims="1" /></a></p>
<h3>DTCoreText News</h3>
<p>Amongst the fixes that made this maintenance release necessary where:</p>
<ul>
<li>Fixed <a title="Block Retain Loop" href="http://www.cocoanetics.com/2012/03/block-retain-loop/">Block-Retain-Cycle</a></li>
<li>Fixed a second minor retain-cycle</li>
<li>Workaround for Chinese Font cascade bug in iOS 5.x (<a href="http://openradar.appspot.com/radar?id=1647415">radar://11262229</a>)</li>
<li>Workaround for a CoreText memory leak in iOS 4.3 (fixed in 5.0)</li>
<li>Some Unit Testing corrections</li>
<li>Updated Readme regarding necessary linker flags</li>
</ul>
<p>I finally got around to also filing a Radar for the cascade bug. The memory leak issue is fixed as of iOS 5, the problem there was that if you replaced the paragraph style attribute on an NSAttributedString with a new one, the previous entry would leak. I fixed that by simply removing the attribute first before calling addAttribute with the new style.</p>
<p>The project has <a href="https://github.com/Cocoanetics/DTCoreText/watchers">surpassed 1000 watchers</a> on GitHub which tells me that it is definitely of use for many people. If you have any app making use of it, then please tell me about it as I like to feature your work. I especially love to receive testimonials <a title="DTCoreText Feedback" href="http://www.cocoanetics.com/2012/03/dtcoretext-feedback/">like this one</a>.</p>
<p>The changes to the Readme reflect the outcome of research done by David Hoerl. The question was to determine which linker flags are really necessary when linking in DTCoreText &#8211; or any other static library that contains categories &#8211; into an app.</p>
<h3>Linker Flags Wisdom</h3>
<p>The linker in general tries to only link in code that is actually used. So if you have C-functions then their code will not end up in the final app binary if it is never being called. This does not work for Objective-C category extensions because of the dynamic nature of method resolution.</p>
<p>Therefore you would generally use the <strong>-ObjC</strong> linker flag when dealing with static libraries that contain Objective-C code.</p>
<p>Greg Parker from Apple who refers to himself as &#8220;Runtime Wrangler&#8221; <a href="http://osdir.com/ml/general/2012-04/msg28235.html">explains</a> it like this:</p>
<blockquote><p>-all_load and -force_load <strong>act at link time</strong>, not at load time. -all_load and<br />
-force_load tell the linker to link the entire static archive in the final<br />
executable, even if the linker thinks that parts of the archive are unused.</p>
<p>When you link a traditional C static archive (.a file), any code from the<br />
archive that is never referenced in the final executable is simply omitted from<br />
the executable. So if you had a static archive with 999 functions you did not<br />
call and 1 function that you did call, your final executable would include only<br />
that one function.</p>
<p>Objective-C categories break the C static archive model, because you want the<br />
Objective-C category to appear in the final executable even though there are no<br />
C symbol references to it from the executable.</p>
<p>The <strong>best solution for Objective-C categories in static archives is the -ObjC</strong><br />
<strong> linker option</strong>, which tells the linker that all Objective-C categories in the<br />
archives are &#8220;used&#8221; but to apply the usual reference algorithm for everything<br />
else in the archives.</p>
<p>The -ObjC option is <strong>broken in some versions of the linker</strong>. For those cases the<br />
-force_load and -all_load options work. The final executable may be larger than<br />
necessary with those options, if there were classes or C functions that could<br />
have been omitted by the linker. If you have multiple archives and only some of<br />
them have Objective-C code then -force_load may generate smaller output than<br />
-all_load.</p></blockquote>
<p>On iOS you&#8217;d typically only link in libraries that you need, as opposed to traditional C or C++ where you&#8217;d often link in large static libraries that are collections of utility methods. So in the case where the libDTCoreText.a is the only static library should be  no difference between force_load and all_load at all.</p>
<p>Personally I prefer the simplest approach which is to first try to get by with only -ObjC and if I get unrecognized selector crashes to additionally add -force_load because there I don&#8217;t need to know or specify the path to the specific library.</p>
<h3>DTRichTextEditor</h3>
<p>I&#8217;ve streamed all the 1.0.1 updates also into DTRichTextEditor which uses DTCoreText for display of rich text. Changes there include:</p>
<ul>
<li>Support Left, Center, Right and Justified toggling of paragraphs</li>
<li>Preliminary work on supporting lists</li>
</ul>
<p>I love to get feedback from people who are actually using the editor in shipping apps. The most prominent one is Dootrix who made the <a href="http://www.simpl.com/">Simpl iPad app</a>. I <a title="Podcast #33 – “Rich Texting”" href="http://www.cocoanetics.com/2012/04/podcast-33-rich-texting/">interviewed the maker</a> on my podcast, if you haven&#8217;t done so I urge you to listen to it as I think it was one of the most enlightening conversations I ever had on air.</p>
<p><a href="http://i2.wp.com/www.cocoanetics.com/files/mzl.qmfvnljn.480x480-75.jpg"><img class="alignnone size-full wp-image-6257" title="Simpl app using DTRichTextEditor" src="http://i2.wp.com/www.cocoanetics.com/files/mzl.qmfvnljn.480x480-75.jpg?resize=480%2C351" alt="" data-recalc-dims="1" /></a></p>
<p>I keep getting requests for a ways to test the editor component before purchasing it. Also the work on lists as well as some feature requests are still open for the editor.</p>
<p>Unfortunately I won&#8217;t have any time to devote to these requests as we are in &#8220;crunch time&#8221; for a major project of maximum importance for the next two weeks. Therefore I ask for some patience.</p>
<h3>The Future</h3>
<p>I&#8217;m not making very much money from selling licenses. Only enough to justify it as a hobby. I might be forced to dramatically raise the price in the near future. So if you are thinking of buying then better do so now, because you then will have access to my Subversion repository and get the benefit of all future updates.</p>
<p>On the above mentioned podcast episode I also discussed what my thoughts where related to the future of rich text editing on iOS.</p>
<p>I am happy if Apple takes on more of the burden that DTCoreText and DTRichTextEditor are currently carrying. It is astonishing that they truly believe that people would use contentEditable UIWebViews for that task. As iPads become equal-partners in content creation this is an essential platform feature.</p>
<p>There are two levels that I can see Apple move forward on:</p>
<ul>
<li>Add the missing protocols and interfaces for interacting with selections and the magnifying glass &#8211; you would still have to create your own editor but at least you could do way more easily</li>
<li>Enhance UITextView &#8211; which is using <a href="http://code.google.com/p/iphone-dev/source/browse/branches/include-1.2-sdk/include/UIKit/UITextView.h?r=266">WebKit under the hood</a> already &#8211; to be editable. Or alternatively create a totally new Rich Text Editing View.</li>
</ul>
<p>Either way I will still have a market and and audience while people support 4.3 and above, or 5.0 and above when 6.0 finally ships. I would predict the former and not bet on the latter.</p>
<p>To cut a long story short: progress is being made and patience is required.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=6255&amp;md5=06938ab9e3ec6f3c8f79b6abe64f38f8" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2012/04/dtcoretext-1-0-1-linker-flags-and-rich-text-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2012%2F04%2Fdtcoretext-1-0-1-linker-flags-and-rich-text-news%2F&amp;language=en_GB&amp;category=text&amp;title=DTCoreText+1.0.1%2C+Linker+Flags+and+Rich+Text+News&amp;description=I+reported+a+while+ago+that+I+was+forced+to+tag+the+current+state+of+the+DTCoreText+master+repository+as+1.0.0.+The+reason+for+this+was+that+CocoaPods+was+starting...&amp;tags=DTCoreText%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>
