From dd4d37b8fed74711513816493e08c847d4894007 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 20 Jul 2017 20:16:12 +0100 Subject: [PATCH] fixes problems with TTCs from the TTCs speed optimization. Some TTCs only have CFF's (e.g. Noto), and some others have non-uniform set of tables across members e.g. wqy-zenhei.ttc - only one member has EBDT/EBLC tables plus cosmetic change. typo --- OTFontFileVal/OTFontVal.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/OTFontFileVal/OTFontVal.cs b/OTFontFileVal/OTFontVal.cs index baa831b..8395af6 100644 --- a/OTFontFileVal/OTFontVal.cs +++ b/OTFontFileVal/OTFontVal.cs @@ -220,7 +220,7 @@ public bool Validate() // rasterization test - BW v.OnRastTestValidationEvent_BW(true); - if ( Is_TTC_LaterIdenticalTable("glyf") ) + if ( v.PeformRastTest_BW() && Is_TTC_LaterIdenticalTable("glyf") ) { v.Info(T.T_NULL, I.glyf_I_IDENTICAL_GLYF_TABLES_IN_TTC, null, "B/W Rasterization"); } @@ -278,7 +278,7 @@ public bool Validate() // rasterization test - Grayscale v.OnRastTestValidationEvent_Grayscale(true); - if ( Is_TTC_LaterIdenticalTable("glyf") ) + if ( v.PeformRastTest_Grayscale() && Is_TTC_LaterIdenticalTable("glyf") ) { v.Info(T.T_NULL, I.glyf_I_IDENTICAL_GLYF_TABLES_IN_TTC, null, "Grayscale Rasterization"); } @@ -337,7 +337,7 @@ public bool Validate() // rasterization test - Cleartype v.OnRastTestValidationEvent_Cleartype(true); - if ( Is_TTC_LaterIdenticalTable("glyf") ) + if ( v.PeformRastTest_Cleartype() && Is_TTC_LaterIdenticalTable("glyf") ) { v.Info(T.T_NULL, I.glyf_I_IDENTICAL_GLYF_TABLES_IN_TTC, null, "Cleartype Rasterization"); } @@ -1232,8 +1232,13 @@ protected bool Is_TTC_LaterIdenticalTable(string s) { // checksum not matching data is covered by check elsewhere. Assume they match. DirectoryEntry de_current = GetDirectoryEntry(s); + if ( de_current == null ) + return false; for ( uint i = 0 ; i < GetFontIndexInFile() ; i++ ) { + if ( GetFile().GetFont(i).GetDirectoryEntry(s) == null ) + return false; + if ( GetFile().GetFont(i).GetDirectoryEntry(s).checkSum == de_current.checkSum ) {