Imported Upstream version 2.6.4
[platform/upstream/harfbuzz.git] / src / hb-aat-layout-trak-table.hh
index 0c8e455..99dddd8 100644 (file)
@@ -62,11 +62,11 @@ struct TrackTableEntry
   }
 
   protected:
-  Fixed                track;          /* Track value for this record. */
+  HBFixed              track;          /* Track value for this record. */
   NameID       trackNameID;    /* The 'name' table index for this track.
                                 * (a short word or phrase like "loose"
                                 * or "very tight") */
-  NNOffsetTo<UnsizedArrayOf<FWORD> >
+  NNOffsetTo<UnsizedArrayOf<FWORD>>
                valuesZ;        /* Offset from start of tracking table to
                                 * per-size tracking values for this track. */
 
@@ -82,7 +82,7 @@ struct TrackData
                        const void *base) const
   {
     unsigned int sizes = nSizes;
-    hb_array_t<const Fixed> size_table ((base+sizeTable).arrayZ, sizes);
+    hb_array_t<const HBFixed> size_table ((base+sizeTable).arrayZ, sizes);
 
     float s0 = size_table[idx].to_float ();
     float s1 = size_table[idx + 1].to_float ();
@@ -93,13 +93,6 @@ struct TrackData
 
   int get_tracking (const void *base, float ptem) const
   {
-    /* CoreText points are CSS pixels (96 per inch),
-     * NOT typographic points (72 per inch).
-     *
-     * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
-     */
-    float csspx = ptem * 96.f / 72.f;
-
     /*
      * Choose track.
      */
@@ -127,14 +120,14 @@ struct TrackData
     if (!sizes) return 0.;
     if (sizes == 1) return trackTableEntry->get_value (base, 0, sizes);
 
-    hb_array_t<const Fixed> size_table ((base+sizeTable).arrayZ, sizes);
+    hb_array_t<const HBFixed> size_table ((base+sizeTable).arrayZ, sizes);
     unsigned int size_index;
     for (size_index = 0; size_index < sizes - 1; size_index++)
-      if (size_table[size_index].to_float () >= csspx)
-        break;
+      if (size_table[size_index].to_float () >= ptem)
+       break;
 
-    return round (interpolate_at (size_index ? size_index - 1 : 0, csspx,
-                                 *trackTableEntry, base));
+    return roundf (interpolate_at (size_index ? size_index - 1 : 0, ptem,
+                                  *trackTableEntry, base));
   }
 
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
@@ -148,7 +141,7 @@ struct TrackData
   protected:
   HBUINT16     nTracks;        /* Number of separate tracks included in this table. */
   HBUINT16     nSizes;         /* Number of point sizes included in this table. */
-  LOffsetTo<UnsizedArrayOf<Fixed>, false>
+  LOffsetTo<UnsizedArrayOf<HBFixed>, false>
                sizeTable;      /* Offset from start of the tracking table to
                                 * Array[nSizes] of size values.. */
   UnsizedArrayOf<TrackTableEntry>
@@ -183,7 +176,7 @@ struct trak
       hb_position_t advance_to_add = c->font->em_scalef_x (tracking);
       foreach_grapheme (buffer, start, end)
       {
-        if (!(buffer->info[start].mask & trak_mask)) continue;
+       if (!(buffer->info[start].mask & trak_mask)) continue;
        buffer->pos[start].x_advance += advance_to_add;
        buffer->pos[start].x_offset += offset_to_add;
       }
@@ -196,7 +189,7 @@ struct trak
       hb_position_t advance_to_add = c->font->em_scalef_y (tracking);
       foreach_grapheme (buffer, start, end)
       {
-        if (!(buffer->info[start].mask & trak_mask)) continue;
+       if (!(buffer->info[start].mask & trak_mask)) continue;
        buffer->pos[start].y_advance += advance_to_add;
        buffer->pos[start].y_offset += offset_to_add;
       }