[trak] Handle nSizes=0 and 1
diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index 63dd890..368c55c 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -93,7 +93,9 @@
Fixed fixed_size;
fixed_size.set_float (csspx);
- /* XXX Clean this up. Make it work with nSizes==1 and 0. */
+ /*
+ * Choose track.
+ */
const TrackTableEntry *trackTableEntry = nullptr;
unsigned int count = nTracks;
@@ -112,8 +114,15 @@
}
if (!trackTableEntry) return 0.;
+ /*
+ * Choose size.
+ */
+
unsigned int sizes = nSizes;
+ if (!sizes) return 0.;
+ if (sizes == 1) return trackTableEntry->get_value (base, 0, sizes);
+
/* TODO bfind() */
unsigned int size_index;
UnsizedArrayOf<Fixed> size_table = base+sizeTable;