Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: CoreText, ligatures, and differences between iOS and Mac OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreText, ligatures, and differences between iOS and Mac OS X



Issue #1 sounds like it may be a problem with the font, if you want us to look into it please file a bug demonstrating the issue with a test app that uses your font.

Issue #2 is probably a bug on our side and is unlikely to change at this point, although don't let that stop you from filing a bug. Setting kCTLigatureAttributeName=0 seems a reasonable workaround on iOS if this behavior is undesirable.

For AAT fonts the default settings are determined according to <https://developer.apple.com/fonts/TTRefMan/RM06/Chap6feat.html>; for OpenType fonts see <http://www.microsoft.com/typography/otfntdev/standot/features.aspx>, et al.

Ned

On May 1, 2012, at 2:36 PM, "Cianflone, Chris" <email@hidden> wrote:

> Hi all,
>
> We have a document based iOS app (mostly a reader app) that we would like to render documents as close as possible to the way the documents are rendered on the Mac OS X desktop app where the documents are created.  We are currently seeing differences with how CoreText handles ligatures on iOS vs. Mac OS X.  Here are 2 issues we are currently running into:
>
> 1. With MeastroTimes (our own font)  on the iPad, the "fi" and "fl" have been substituted with and superscript "5" and superscript "6". This does not happen on Mac OS X.
>
> 2. With Times New Roman on the iPad, the "fi" and "fl" have been substituted with the single ligature character for "fi" and "fl".  This does not happen on Mac OS X.
>
> For both of these, a little background is in order.  Our desktop app is actually still using ATSUI to render text on the desktop.  However, we have a in-house debug switch to turn on our CoreText functionality and since I have checked that CoreText and ATSUI are behaving the same on the desktop with regard to ligatures, I will simply say we are comparing CoreText between iOS and Mac OS X.
>
> My understanding of how ligatures has worked in the past is that a font can have various "font features", among these is "Common Ligatures".  For example, go into TextEdit on Mac OS X and select "Times New Roman" or "Arial" and from the Font panel, select Typography and notices that these fonts have the "Ligatures" feature, including choices for "Common Ligatures" and "Rare Ligatures".
>
> (Another question: in apps that don't allow setting these advanced typography settings, does the font have default values for all the settings?  I assume that is the case based on things like kCTFontFeatureSelectorDefaultKey for CoreText and this section from ATS/SFNTLayoutTypes.h for ATSUI: The following values can be used to set run feature values. Note that unless the feature is defaulted differently in different fonts, the zero value for the selectors represents the default value.)
>
> For the first case above, our MaestroTimes font clearly does not have any typographic font features and yet we are getting the substitution mentioned above.  I have discovered the kCTLigatureAttributeName attribute and by setting this to "0", I can get back to the desired rendering that matches Mac OS X.  But why is this different in iOS?  Why is the system attempting to do ligatures for a font that does not even support that typographic feature? My thought for a work around to all these problems would be to check if a given font has ligature features, and if it does not, simply set kCTLigatureAttributeName to "0".  Or is that not appropriate? Would I be turning off some ligatures that were expected by the user in other fonts?
>
> In the second case, the above proposed work around does not fix the problem.  "Times New Roman" is actually a font that claims to have "Common Ligatures" feature.  However, in our Mac OS X app currently, the "fi" and "fl" characters show up as individual characters, not the special "fi" and "fl" ligatures.  But on iOS they show as the special ligatures.  So do I always set kCTLigatureAttributeName to "0"?  Seems that would certainly disallow some ligatures that were expected by the user in other fonts.  So what is going on here to cause all these discrepancies?
>
> As a side note, in TextEdit, the "fi" and "fl" in "Times New Roman" never show the special "fi" or "fl" ligatures regardless of the settings of the "Common Ligatures" and "Rare Ligatures" features.  I feel I am missing something here.
>
> All of this is being tested in Mac OS X Lion, 10.7.3, and iOS 5.1, and Xcode 4.3.2.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Chris Cianflone
> Senior Software Engineer
> MakeMusic, Inc.
> www.makemusic.com
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coretext-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coretext-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >CoreText, ligatures, and differences between iOS and Mac OS X (From: "Cianflone, Chris" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.