Fix TTC header handling
Also change the Version type to avoid similar bugs in the future.
Reported by Grigori Goronzy.
diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh
index b65e83f..7d43e46 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file-private.hh
@@ -152,7 +152,7 @@
inline unsigned int get_face_count (void) const
{
- switch (u.header.version) {
+ switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1.get_face_count ();
default:return 0;
@@ -160,7 +160,7 @@
}
inline const OpenTypeFontFace& get_face (unsigned int i) const
{
- switch (u.header.version) {
+ switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1.get_face (i);
default:return Null(OpenTypeFontFace);
@@ -170,7 +170,7 @@
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
if (unlikely (!u.header.version.sanitize (c))) return false;
- switch (u.header.version) {
+ switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1.sanitize (c);
default:return true;