[trak] Handle nSizes=0 and 1

This commit is contained in:
Behdad Esfahbod 2018-10-11 10:32:08 -04:00
parent 451f3de521
commit 3d7dea6dfd
1 changed files with 10 additions and 1 deletions

View File

@ -93,7 +93,9 @@ struct TrackData
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 @@ struct TrackData
}
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;