Bug 467228. Disable line start/end swashes on Mac since we don't support line-boundary shaping properly yet. r=roc
authorJonathan Kew <jfkthame@gmail.com>
Wed, 03 Dec 2008 09:58:41 +1300
changeset 22179 7baaa800925d3e2fb14afd71dadc314706d5d383
parent 22178 357d1c01bde3a91b3391e0d5143fa9dd49ed9963
child 22180 9e1eab6135e20b914cc810af5bdc5f58a3ae7da5
push id3843
push userrocallahan@mozilla.com
push dateTue, 02 Dec 2008 21:22:28 +0000
treeherdermozilla-central@31e5958cb97a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs467228
milestone1.9.2a1pre
Bug 467228. Disable line start/end swashes on Mac since we don't support line-boundary shaping properly yet. r=roc
gfx/thebes/src/gfxAtsuiFonts.cpp
--- a/gfx/thebes/src/gfxAtsuiFonts.cpp
+++ b/gfx/thebes/src/gfxAtsuiFonts.cpp
@@ -165,33 +165,37 @@ gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntr
 
 
 ATSUFontID gfxAtsuiFont::GetATSUFontID()
 {
     return GetFontEntry()->GetFontID();
 }
 
 static void
-DisableUncommonLigatures(ATSUStyle aStyle)
+DisableUncommonLigaturesAndLineBoundarySwashes(ATSUStyle aStyle)
 {
     static const ATSUFontFeatureType types[] = {
         kLigaturesType,
         kLigaturesType,
         kLigaturesType,
         kLigaturesType,
         kLigaturesType,
-        kLigaturesType
+        kLigaturesType,
+        kSmartSwashType,
+        kSmartSwashType
     };
     static const ATSUFontFeatureType selectors[NS_ARRAY_LENGTH(types)] = {
         kRareLigaturesOffSelector,
         kLogosOffSelector,
         kRebusPicturesOffSelector,
         kDiphthongLigaturesOffSelector,
         kSquaredLigaturesOffSelector,
-        kAbbrevSquaredLigaturesOffSelector
+        kAbbrevSquaredLigaturesOffSelector,
+        kLineInitialSwashesOffSelector,
+        kLineFinalSwashesOffSelector
     };
     ATSUSetFontFeatures(aStyle, NS_ARRAY_LENGTH(types), types, selectors);
 }
 
 static void
 DisableCommonLigatures(ATSUStyle aStyle)
 {
     static const ATSUFontFeatureType types[] = {
@@ -248,17 +252,21 @@ gfxAtsuiFont::InitMetrics(ATSUFontID aFo
     ATSUSetAttributes(mATSUStyle,
                       NS_ARRAY_LENGTH(styleTags),
                       styleTags,
                       styleArgSizes,
                       styleArgs);
     // Disable uncommon ligatures, but *don't* enable common ones;
     // the font may have default settings that disable common ligatures
     // and we want to respect that.
-    DisableUncommonLigatures(mATSUStyle);
+    // Also disable line boundary swashes because we can't handle them properly;
+    // we don't know where the line-breaks are at the time we're applying shaping,
+    // and it would be bad to put words with line-end swashes into the text-run
+    // cache until we have a way to distinguish them from mid-line occurrences.
+    DisableUncommonLigaturesAndLineBoundarySwashes(mATSUStyle);
 
     /* Now pull out the metrics */
 
     ATSFontMetrics atsMetrics;
     ATSFontGetHorizontalMetrics(aFontRef, kATSOptionFlagsDefault,
                                 &atsMetrics);
 
     if (atsMetrics.xHeight)