当前位置: 首页>>代码示例>>C#>>正文


C# Validator.Info方法代码示例

本文整理汇总了C#中OTFontFileVal.Validator.Info方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.Info方法的具体用法?C# Validator.Info怎么用?C# Validator.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OTFontFileVal.Validator的用法示例。


在下文中一共展示了Validator.Info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Validate

        /************************
         * public methods
         */

        public bool Validate(Validator v, OTFontVal fontOwner)
        {
            bool bRet = true;

            v.Info(T.T_NULL, I.CFF_I_Version, m_tag, major + "." + minor);
            v.Info(I.CFF_I_NotValidated, m_tag);
            
            return bRet;
        }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:13,代码来源:val_CFF.cs

示例2: Validate

        /************************
         * public methods
         */


        public bool Validate(Validator v, OTFontVal fontOwner)
        {
            bool bRet = true;

            v.Info(I.fpgm_I_NotValidated, m_tag);
            
            return bRet;
        }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:13,代码来源:val_fpgm.cs

示例3: Validate


//.........这里部分代码省略.........
                                v.Pass(T.head_MinMaxValues, P.head_P_xMax_glyf, m_tag, s);
                            }
                            else
                            {
                                string s = "actual: " + xMax + ", expected: " + xMaxExpected;
                                v.Error(T.head_MinMaxValues, E.head_E_xMax_glyf, m_tag, s);
                                bRet = false;
                            }

                            if (yMax == yMaxExpected)
                            {
                                String s = "yMax = " + yMax;
                                v.Pass(T.head_MinMaxValues, P.head_P_yMax_glyf, m_tag, s);
                            }
                            else
                            {
                                string s = "actual: " + yMax + ", expected: " + yMaxExpected;
                                v.Error(T.head_MinMaxValues, E.head_E_yMax_glyf, m_tag, s);
                                bRet = false;
                            }
                        }
                        else
                        {
                            v.Error(T.head_MinMaxValues, E._TEST_E_TableMissing, m_tag, "maxp");
                        }
                    }
                    else
                    {
                        v.Error(T.head_MinMaxValues, E._TEST_E_TableMissing, m_tag, "glyf");
                    }
                }
                else
                {
                    v.Info(T.head_MinMaxValues, I._TEST_I_NotForCFF, m_tag, "test = head_MinMaxValues");
                }
            }
            
            if (v.PerformTest(T.head_MacStyleBits))
            {
                bool bMacBold = ((macStyle & 0x0001) != 0);
                bool bMacItal = ((macStyle & 0x0002) != 0);

                // subfamily (style) string

                Table_name nameTable = (Table_name)fontOwner.GetTable("name");
                string sStyle = null;
                string sStyleLower = null;
                if (nameTable != null)
                {
                    sStyle = nameTable.GetStyleString();
                    if (sStyle != null)
                    {
                        sStyleLower = sStyle.ToLower();
                    }
                }
                if (sStyleLower != null)
                {
                    if (bMacBold && sStyleLower.IndexOf("bold") == -1)
                    {
                        v.Error(T.head_MacStyleBits, E.head_E_macStyleBold_subfamily, m_tag, "macStyle bold bit is set, but subfamily is " + sStyle);
                        bRet = false;
                    }
                    else if (!bMacBold && sStyleLower.IndexOf("bold") != -1)
                    {
                        v.Error(T.head_MacStyleBits, E.head_E_macStyleBold_subfamily, m_tag, "macStyle bold bit is clear, but subfamily is " + sStyle);
                        bRet = false;
开发者ID:bitforks,项目名称:Font-Validator,代码行数:67,代码来源:val_head.cs

示例4: Validate


//.........这里部分代码省略.........
                                                nTotalGlyphs ++;
                                            }

                                            CalcAvgWidth = (short)(nTotalWidth / nTotalGlyphs);
                                        }

                                        if (xAvgCharWidth == CalcAvgWidth)
                                        {
                                            v.Pass(T.OS_2_xAvgCharWidth, P.OS_2_P_xAvgCharWidth, m_tag);
                                        }
                                        else
                                        {
                                            string s = "actual = " + xAvgCharWidth + ", calc = " + CalcAvgWidth;
                                            v.Error(T.OS_2_xAvgCharWidth, E.OS_2_E_xAvgCharWidth, m_tag, s);
                                            bRet = false;
                                        }
                                    }
                                    else
                                    {
                                        v.Warning(T.OS_2_xAvgCharWidth, W.OS_2_W_hmtx_invalid, m_tag, "unable to parse hmtx table");
                                    }
                                }
                                catch (ApplicationException e)
                                {
                                    v.Warning(T.OS_2_xAvgCharWidth, W._TEST_W_ErrorInAnotherTable, m_tag, "xAvgCharWidth cannot be validated due to " + e.Message);
                                }
                            }
                        }

                    }
                    else
                    {
                        // not a TT outline font - should embedded bitmap only font be handled here?
                        v.Info(T.OS_2_xAvgCharWidth, I._TEST_I_NotForCFF, m_tag, "test = OS/2_xAvgCharWidth");
                    }

                }
            }

            if (v.PerformTest(T.OS_2_WeightClass))
            {
                if (usWeightClass >= 100 &&
                    usWeightClass <= 900 &&
                    usWeightClass% 100 == 0)
                {
                    bool bWeightClassOk = true;

                    // compare to the PANOSE weight value
                    if (panose_byte1 == 2 || panose_byte1 == 3 || panose_byte1 == 4) // latin text, hand writing, or decorative
                    {
                        if (panose_byte3 > 1)
                        {
                            // convert PANOSE weight value from a range of [2..11] to a range of [100..900] (reasonably close anyway, given integer math)
                            int nConvertedPANOSE = (panose_byte3-2)*89+100;
                            int nDifference = Math.Abs(usWeightClass - nConvertedPANOSE);
                            if (nDifference < 200)
                            {
                                v.Pass(T.OS_2_WeightClass, P.OS_2_P_WeightClass_PANOSE, m_tag);
                            }
                            else
                            {
                                v.Warning(T.OS_2_WeightClass, W.OS_2_W_WeightClass_PANOSE, m_tag, "usWeightClass = " + usWeightClass + ", PANOSE weight = " + panose_byte3);
                                bWeightClassOk = false;
                            }
                        }
                    }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:67,代码来源:val_OS2.cs

示例5: VerifyUnicodeRanges

        bool VerifyUnicodeRanges( Validator  v,
            uint        ulUnicodeRange,
            uint        ulUnicodeRangeBit,
            uint        nCharsInRange,
            string      sRangeNames)
        {
            bool bRet = true;
            if(nCharsInRange != 0)
            {
                if((ulUnicodeRange & ulUnicodeRangeBit) == 0)
                {
                    v.Info(T.T_NULL, I.OS_2_I_RangeBitNotSet, m_tag, nCharsInRange + " characters are present in the ranges: " + sRangeNames);
                }
            }
            else
            {
                if((ulUnicodeRange & ulUnicodeRangeBit) != 0)
                {
                    v.Error(T.T_NULL, E.OS_2_E_RangeBitSet, m_tag, "No characters are present in the ranges: " + sRangeNames);
                    bRet = false;
                }
            }

            return bRet;
        }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:25,代码来源:val_OS2.cs

示例6: Validate

        /************************
         * public methods
         */


        public bool Validate(Validator v, OTFontVal fontOwner)
        {
            string sDetails = "";

            string [] Apple_Tables = 
                {
                    "acnt", "avar", "bdat", "bhed", "bloc", "bsln", "cmap", "cvar", "cvt ",
                    "EBSC", "fdsc", "feat", "fmtx", "fpgm", "gasp", "glyf", "gvar", "hdmx",
                    "head", "hhea", "hmtx", "hsty", "just", "kern", "lcar", "loca", "maxp",
                    "mort", "morx", "name", "opbd", "OS/2", "post", "prep", "prop", "trak",
                    "vhea", "vmtx", "Zapf"
                };

            string [] VOLT_only_Tables = 
                {
                    "TSIV"
                };

            string [] VOLT_VTT_shared_Tables = 
                {
                    "TSIS", "TSIP", "TSID"
                };

            string [] VTT_only_Tables =
                {
                    "TSI0", "TSI1", "TSI2", "TSI3", "TSI4", "TSI5" ,"TSIJ", "TSIB"
                };

            bool bIdentified = false;

            for (int i=0; i<Apple_Tables.Length; i++)
            {
                if (Apple_Tables[i] == (string)m_tag)
                {
                    sDetails = "This table type is defined in the Apple TrueType spec.";
                    bIdentified = true;
                }
            }

            if (!bIdentified)
            {
                for (int i=0; i<VOLT_only_Tables.Length; i++)
                {
                    if (VOLT_only_Tables[i] == (string)m_tag)
                    {
                        sDetails = "This table type is used by the VOLT tool.";
                        bIdentified = true;
                    }
                }
            }

            if (!bIdentified)
            {
                for (int i=0; i<VOLT_VTT_shared_Tables.Length; i++)
                {
                    if (VOLT_VTT_shared_Tables[i] == (string)m_tag)
                    {
                        sDetails = "This table type is used by the VOLT tool and the VTT tool.";
                        bIdentified = true;
                    }
                }
            }

            if (!bIdentified)
            {
                for (int i=0; i<VTT_only_Tables.Length; i++)
                {
                    if (VTT_only_Tables[i] == (string)m_tag)
                    {
                        sDetails = "This table type is used by the VTT tool.";
                        bIdentified = true;
                    }
                }
            }

            v.Info(T.T_NULL, I._Table_I_Non_OT_Table, m_tag, sDetails);

            // Since there is no way to do any validation on unknown tables
            // always return true

            return true;
        }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:87,代码来源:val__Unknown.cs

示例7: Validate

            public bool Validate(Validator v, string sIdentity, OTTable table)
            {
                bool bRet = true;

                bRet &= ((val_GDEF)table).ValidateNoOverlap(m_offsetMarkGlyphSetsDefTable, CalcLength(), v, sIdentity, table.GetTag());

                if (MarkSetTableFormat != 1)
                {
                    v.Error(T.T_NULL, E.GDEF_E_MarkSetTableFormat, table.m_tag,
                            sIdentity + ": MarkSetTableFormat=" + MarkSetTableFormat.ToString());
                    bRet = false;
                }

                if (m_offsetMarkGlyphSetsDefTable + CalcLength() > m_bufTable.GetLength())
                {
                    v.Error(T.T_NULL, E.GDEF_E_MarkGlyphSetsDefTable_PastEOT, table.m_tag, sIdentity);
                    bRet = false;
                }

                v.Info(T.T_NULL, I.GDEF_I_MarkSetCount, table.m_tag, sIdentity + ": MarkSetCount=" + MarkSetCount);
                // TODO: check Coverage [MarkSetCount] array?

                if (bRet)
                {
                    v.Pass(T.T_NULL, P.GDEF_P_MarkGlyphSetsDefTable, table.m_tag, sIdentity);
                }

                return bRet;
            }
开发者ID:schriftgestalt,项目名称:Font-Validator,代码行数:29,代码来源:val_GDEF.cs

示例8: Validate


//.........这里部分代码省略.........
                                    {
                                        string sDetails = "name string(" + nr.PlatformID 
                                            + ", " + nr.EncodingID
                                            + ", 0x" + nr.LanguageID.ToString("x4")
                                            + ", " + nr.NameID
                                            + ")";
                                        v.Pass(T.name_SampleString, P.name_P_sample, m_tag, sDetails);
                                    }
                                }
                            }
                        }
                    }
                }
            }

			if (v.PerformTest(T.name_PreferredFamily))
			{
				bool bFound = false;

				for (uint i=0; i<NumberNameRecords; i++)
				{
					NameRecord nr = GetNameRecord(i);
					if (nr != null)
					{
						if (nr.NameID == 16)
						{
							string sPrefFam = this.GetString(nr.PlatformID, nr.EncodingID, nr.LanguageID, 16);

							string s = "platID = " + nr.PlatformID 
									+ ", encID = " + nr.EncodingID
									+ ", langID = " + nr.LanguageID
									+ ", nameID = " + nr.NameID
									+ ", \"" + sPrefFam + "\"";
							v.Info(T.name_PreferredFamily, I.name_I_Preferred_family_present, m_tag, s);

							bFound = true;
						}
					}
				}

				if (!bFound)
				{
					v.Info(T.name_PreferredFamily, I.name_I_Preferred_family_not_present, m_tag);
				}
			}

			if (v.PerformTest(T.name_PreferredSubfamily))
			{
				bool bFound = false;

				for (uint i=0; i<NumberNameRecords; i++)
				{
					NameRecord nr = GetNameRecord(i);
					if (nr != null)
					{
						if (nr.NameID == 17)
						{
							string sPrefSubfam = this.GetString(nr.PlatformID, nr.EncodingID, nr.LanguageID, 17);

							string s = "platID = " + nr.PlatformID 
								+ ", encID = " + nr.EncodingID
								+ ", langID = " + nr.LanguageID
								+ ", nameID = " + nr.NameID
								+ ", \"" + sPrefSubfam + "\"";
							v.Info(T.name_PreferredSubfamily, I.name_I_Preferred_subfamily_present, m_tag, s);
开发者ID:schriftgestalt,项目名称:Font-Validator,代码行数:66,代码来源:val_name.cs

示例9: ValidateTable

        /*****************
        * protected methods
        */

        /*****************
         * public methods
         */

        //meant to avoid code repetition (is called from OTFontVal too)
        public bool ValidateTable(OTTable table, Validator v, DirectoryEntry de, OTFontVal fontOwner)
        {
            String tname = GetTableManager().GetUnaliasedTableName(de.tag);
            bool bRet = true;

            // verify the checksum value from the directory entry matches the checksum for the table
            if (!(tname == "DSIG" && IsCollection()))
            {
                uint calcChecksum = 0;
                if (table != null)
                {
                    calcChecksum = table.CalcChecksum();
                }

                if (de.checkSum != calcChecksum)
                {
                    string s = "table '" + de.tag + "', calc: 0x" + calcChecksum.ToString("x8") + ", font: 0x" + de.checkSum.ToString("x8");
                    v.Error(T.T_NULL, E._DE_E_ChecksumError, de.tag, s);
                    bRet = false;
                }
            }

            // verify that table has pad bytes set to zero
            if (table != null)
            {
                uint nBytes = GetNumPadBytesAfterTable(table);

                bool bPadBytesZero = true;

                if (nBytes != 0)
                {
                    long PadFilePos = table.GetBuffer().GetFilePos() + table.GetBuffer().GetLength();
                    byte[] padbuf = ReadBytes(PadFilePos, nBytes);
                    for (int iByte = 0; iByte < padbuf.Length; iByte++)
                    {
                        if (padbuf[iByte] != 0)
                        {
                            bPadBytesZero = false;
                            break;
                        }
                    }

                }

                if (bPadBytesZero == false)
                {
                    v.Warning(T.T_NULL, W._DE_W_PadBytesNotZero, de.tag, "after " + de.tag + " table");
                }
            }

            // ask the table object to validate its data
            if (!(tname == "DSIG" && IsCollection())) v.OnTableValidationEvent(de, true);
            if (table != null)
            {
                if (v.TestTable(de.tag)) // don't test deselected tables
                {
                    try
                    {
                        ITableValidate valtable = (ITableValidate)table;
                        bRet &= valtable.Validate(v, fontOwner);
                    }
                    catch (InvalidCastException e)
                    {
                        v.ApplicationError(T.T_NULL, E._Table_E_Exception, table.m_tag, e.ToString());
                        bRet = false;
                    }
                }
                else
                {
                    v.Info(I._Table_I_NotSelected, de.tag);
                }
            }
            else
            {
                if (de.length == 0)
                {
                    // check if it's a known OT table type since zero length private tables seem allowable
                    if (TableManager.IsKnownOTTableType(de.tag))
                    {
                        v.Error(T.T_NULL, E._Table_E_Invalid, de.tag, "The directory entry length is zero");
                        bRet = false;
                    }
                }
                else if (de.offset == 0)
                {
                    v.Error(T.T_NULL, E._Table_E_Invalid, de.tag, "The directory entry offset is zero");
                    bRet = false;
                }
                else if (de.offset > GetFileLength())
                {
                    v.Error(T.T_NULL, E._Table_E_Invalid, de.tag, "The table offset points past end of file");
//.........这里部分代码省略.........
开发者ID:bitforks,项目名称:Font-Validator,代码行数:101,代码来源:OTFileVal.cs

示例10: Validate


//.........这里部分代码省略.........
                    {
                        v.Error(T.maxp_TableLength, E.maxp_E_LENGTH_1_0, m_tag, m_bufTable.GetLength().ToString());
                        bRet = false;
                    }
                }
            }

            if (v.PerformTest(T.maxp_NumGlyphsMatchLoca))
            {
                if (TableVersionNumber.GetUint() == 0x00010000)
                {
                    Table_loca locaTable = (Table_loca)fontOwner.GetTable("loca");
                    if (locaTable != null)
                    {
                        // locaTable.NumEntry returns (-1) on failure
                        if (locaTable.NumEntry(fontOwner) == NumGlyphs+1)
                        {
                            v.Pass(T.maxp_NumGlyphsMatchLoca, P.maxp_P_NumGlyphsMatchLoca, m_tag, "numGlyphs = " + NumGlyphs);
                        }
                        else
                        {
                            v.Error(T.maxp_NumGlyphsMatchLoca, E.maxp_E_NumGlyphsMatchLoca, m_tag, "numGlyphs = " + NumGlyphs);
                            bRet = false;
                        }
                    }
                    else
                    {
                        v.Error(T.maxp_NumGlyphsMatchLoca, E._TEST_E_TableMissing, m_tag, "loca");
						bRet = false;
                    }
                }
                else
                {
                    v.Info(T.maxp_NumGlyphsMatchLoca, I._TEST_I_TableVersion, m_tag, "test = maxp_NumGlyphsMatchLoca");
                }
            }

            if (v.PerformTest(T.maxp_GlyphStats))
            {
                if (TableVersionNumber.GetUint() == 0x00010000)
                {
                    Table_glyf glyfTable = (Table_glyf) fontOwner.GetTable("glyf");

                    if (glyfTable == null)
                    {
                        v.Error(T.maxp_GlyphStats, E._TEST_E_TableMissing, m_tag, "glyf");
						bRet = false;
                    }
                    else
                    {

                        bool bGlyphStatsOk = true;

                        if (ComputeMaxpStats(glyfTable, fontOwner))
                        {

                            if (maxPoints != maxPointsCalc)
                            {
                                String sDetails = "maxPoints = " + maxPoints + ", calculated = " + maxPointsCalc;
                                v.Error(T.maxp_GlyphStats, E.maxp_E_Calculation, m_tag, sDetails);
                                bRet = false;
                                bGlyphStatsOk = false;
                            }

                            if (maxContours != maxContoursCalc)
                            {
开发者ID:bitforks,项目名称:Font-Validator,代码行数:67,代码来源:val_maxp.cs

示例11: CheckNames

 private bool CheckNames( Validator v,
                          OTFontVal fontOwner,
                          PostNames pn,
                          uint iGlyph,
                          uint index )
 {
     bool bNamesOk = true;
     string sName = GetNameString(index-258);
     System.Globalization.NumberStyles hexStyle = 
         System.Globalization.NumberStyles.HexNumber;
     if (Is_uniXXXX(sName))
     {
         char c = (char)Int16.Parse(sName.Substring(3, 4), hexStyle );
         if (fontOwner.FastMapUnicodeToGlyphID(c) != iGlyph)
         {
             char cMapped = fontOwner.MapGlyphIDToUnicode(iGlyph,(char)0);
             string s = "glyph = " + iGlyph +
                 ", char = U+" + 
                 ((uint)cMapped).ToString("X4")
                 + ", name = " + sName;
             v.Info(T.post_v2_names, 
                    I.post_I_names_uni_unexpected, 
                    m_tag, s);
             bNamesOk = false;
         }
     }
     else if (Is_uXXXXX(sName))
     {
         uint c = (uint)Int32.Parse(sName.Substring(1), hexStyle );
         if (c < 0xffff)
         {
             if (fontOwner.FastMapUnicodeToGlyphID((char)c) != iGlyph)
             {
                 char cMapped = fontOwner.MapGlyphIDToUnicode(iGlyph, 
                                                              (char)0);
                 string s = "glyph = " + iGlyph + ", char = U+" +
                     ((uint)cMapped).ToString("X4") + ", name = " + sName;
                 v.Info(T.post_v2_names, I.post_I_names_uni_unexpected, 
                        m_tag, s);
                 bNamesOk = false;
             }
         }
         else
         {
             if (fontOwner.FastMapUnicode32ToGlyphID(c) != iGlyph)
             {
                 uint cMapped = 
                     fontOwner.MapGlyphIDToUnicode32(iGlyph, 0);
                 string s = "glyph = " + iGlyph + ", char = U+" + 
                     ((uint)cMapped).ToString("X5") + ", name = " + sName;
                 v.Info(T.post_v2_names, I.post_I_names_uni_unexpected, 
                        m_tag, s);
                 bNamesOk = false;
             }
         }
     }
     else
     {
         // check the Adobe Glyph Names
         
         char c = (char)fontOwner.MapGlyphIDToUnicode(iGlyph, (char)0);
         if (c != 0xffff)
         {
             string sAdobeName = pn.GetAdobeGlyphName(c);
             if (sAdobeName == null)
             {
                 string s = "glyph = " + iGlyph + ", char = U+" + 
                     ((uint)c).ToString("X4") + ", name = " + sName;
                 v.Info(T.post_v2_names, I.post_I_names_noAdobe, m_tag,s);
                 bNamesOk = false;
             }
             else if (sName != sAdobeName)
             {
                 string s = "glyph = " + iGlyph + ", char = U+" + 
                     ((uint)c).ToString("X4") + ", name = " + sName;
                 v.Info(T.post_v2_names, I.post_I_names_nomatch, m_tag,s);
                 bNamesOk = false;
             }
         }
     }
     return bNamesOk;
 }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:82,代码来源:val_post.cs

示例12: Validate


//.........这里部分代码省略.........
                else if (bFixedPitchOk && hmtxTable != null && OS2Table == null)
                {
                    v.Pass(T.post_isFixedPitch, P.post_P_isFixedPitch, m_tag, "matches the hmtx table");
                }
            }

            if (v.PerformTest(T.post_v2_numberOfGlyphs))
            {
                if (Version.GetUint() == 0x00020000)
                {
                    Table_maxp maxpTable = (Table_maxp)fontOwner.GetTable("maxp");
                    if (maxpTable == null)
                    {
                        v.Error(T.post_v2_numberOfGlyphs, E._TEST_E_TableMissing, m_tag, "maxp table is missing");
						bRet = false;
                    }
                    else
                    {
                        if (numberOfGlyphs == fontOwner.GetMaxpNumGlyphs())
                        {
                            v.Pass(T.post_v2_numberOfGlyphs, P.post_P_v2_numberOfGlyphs, m_tag);
                        }
                        else
                        {
                            v.Error(T.post_v2_numberOfGlyphs, E.post_E_v2_numberOfGlyphs,
                                    m_tag, "numberOfGlyphs = " + numberOfGlyphs + 
                                    ", maxp.numGlyphs = " + fontOwner.GetMaxpNumGlyphs());
                            bRet = false;
                        }
                    }
                }
                else
                {
                    v.Info(T.post_v2_numberOfGlyphs, I.post_I_v2_numberOfGlyphs_notv2, m_tag);
                }
            }

            if (v.PerformTest(T.post_v2_glyphNameIndex))
            {
                if (Version.GetUint() == 0x00020000 && GetLength() >= 34)
                {
                    bool bIndexOk = true;

                    for (uint i=0; i<numberOfGlyphs; i++)
                    {
                        if ((uint)FieldOffsetsVer2.glyphNameIndex + i*2 + 2 <= m_bufTable.GetLength())
                        {
                            ushort index = GetGlyphNameIndex((ushort)i);
                            if (index-258 >= m_nameOffsets.Length)
                            {
                                string s = "glyphNameIndex[" + i + "] = " + 
                                    index + ", # names = " + m_nameOffsets.Length;
                                v.Error(T.post_v2_glyphNameIndex, E.post_E_glyphNameIndex_range, m_tag, s);
                                bIndexOk = false;
                                bRet = false;
                            }
                        }
                        else
                        {
                            v.Warning(T.post_v2_glyphNameIndex, 
                                      W._TEST_W_OtherErrorsInTable, m_tag, 
                                      "unable to validate any more glyph indexes, index  " + 
                                      i + " is past end of table");
                            bIndexOk = false;
                            break;
                        }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:67,代码来源:val_post.cs

示例13: ValidateGlyfEntryEmpty

 private bool ValidateGlyfEntryEmpty(Validator validator,
     OTFont fontOwner)
 {
     int cntInfo=0;
     int numEntry=this.NumEntry(fontOwner);
     if (numEntry==Table_loca.ValueInvalid)
     {
         if (validator!=null)
         {
             validator.Warning(T.T_NULL, W._TEST_W_OtherErrorsInTable, 
                 m_tag,
                 "Unable to determine the number of entries in the 'loca' table");
         }
         return false;
     }
     
     int offsGlyfCur, offsGlyfNext;            
     for (int iEntry=0; iEntry<numEntry-1; iEntry++)
     {
         if ((!this.GetGlyfOffset(iEntry, out offsGlyfCur, validator, fontOwner))||
             (!this.GetGlyfOffset(iEntry+1, out offsGlyfNext, validator, fontOwner)))
         {
             cntInfo++;
             continue;
         }
         if (offsGlyfNext==offsGlyfCur)
         {
             cntInfo++;
         }
     }
     if (validator!=null)
     {
         if (cntInfo==0)
         {
             validator.Pass(P.loca_P_GlyfEntryEmpty, m_tag);
         }
         else
         {
             validator.Info(T.T_NULL, I.loca_I_GlyfEntryEmpty, 
                 m_tag,
                 "Number of glyphs that are empty = "+cntInfo);
         }
     }
     return (cntInfo==0);
 }
开发者ID:bitforks,项目名称:Font-Validator,代码行数:45,代码来源:val_loca.cs

示例14: Validate

        /************************
         * public methods
         */

        public bool Validate(Validator v, OTFontVal fontOwner)
        {
            bool bRet = true;

            v.Info(T.T_NULL, I.CFF_I_Version, m_tag, major + "." + minor);

            if ( major == 1 && minor == 0 && hdrSize == 4 )
            {
                v.Pass(T.CFF_Header, P.CFF_P_Header, m_tag);
            }
            else
            {
                v.Error(T.CFF_Header, E.CFF_E_Header, m_tag,
                        "major=" + major + ", minor=" + minor + ", hdrSize=" + hdrSize + ", offSize=" + offSize);
            }

            try
            {
                v.Pass(T.CFF_MAININDEX_Enumeration, P.CFF_P_MAININDEX_Enumeration, m_tag,
                       "Name=" + Name.count + ", TopDICT=" + TopDICT.count + ", String=" + String.count + ", GlobalSubr=" + GlobalSubr.count);
            }
            catch (Exception e)
            {
                v.Error(T.CFF_MAININDEX_Enumeration, E.CFF_E_MAININDEX_Enumeration, m_tag,
                        e.Message);

                return false;
            }

            if ( Name.count == TopDICT.count && TopDICT.count == 1)
            {
                v.Pass(T.CFF_NameDICTSize, P.CFF_P_NameDICTSize, m_tag);
            }
            else
            {
                v.Error(T.CFF_NameDICTSize, E.CFF_E_NameDICTSize, m_tag,
                        "Name=" + Name.count + ", TopDICT=" + TopDICT.count);
            }

            if (Name.GetOffset(0) != 1)
                v.Warning( T.CFF_INDEXFirstOffset, W.CFF_W_INDEXFirstOffset, m_tag, "Name=" + Name.GetOffset(0) );
            if (TopDICT.GetOffset(0) != 1)
                v.Warning( T.CFF_INDEXFirstOffset, W.CFF_W_INDEXFirstOffset, m_tag, "TopDICT=" + TopDICT.GetOffset(0) );
            if (String.GetOffset(0) != 1)
                v.Warning( T.CFF_INDEXFirstOffset, W.CFF_W_INDEXFirstOffset, m_tag, "String=" + String.GetOffset(0) );
            if (GlobalSubr.GetOffset(0) != 1)
                v.Warning( T.CFF_INDEXFirstOffset, W.CFF_W_INDEXFirstOffset, m_tag, "GlobalSubr=" + GlobalSubr.GetOffset(0) );

            var overlap = new DataOverlapDetector();

            if ( !overlap.CheckForNoOverlap(0, hdrSize) )
                v.Error(T.CFF_StructOverlap, E.CFF_E_StructOverlap, m_tag, "hdrSize");
            if ( !overlap.CheckForNoOverlap(Name.begin, Name.size) )
                v.Error(T.CFF_StructOverlap, E.CFF_E_StructOverlap, m_tag, "Name");
            if ( !overlap.CheckForNoOverlap(TopDICT.begin, TopDICT.size) )
                v.Error(T.CFF_StructOverlap, E.CFF_E_StructOverlap, m_tag, "TopDICT");
            if ( !overlap.CheckForNoOverlap(String.begin, String.size) )
                v.Error(T.CFF_StructOverlap, E.CFF_E_StructOverlap, m_tag, "String");
            if ( !overlap.CheckForNoOverlap(GlobalSubr.begin, GlobalSubr.size) )
                v.Error(T.CFF_StructOverlap, E.CFF_E_StructOverlap, m_tag, "GlobalSubr");

            try
            {
                for(uint i = 0; i< Name.count; i++)
                {
                    var name = Name.GetString(i);
                }

                v.Pass(T.CFF_Non_ASCII_String_or_Name, P.CFF_P_Non_ASCII_String_or_Name, m_tag, "Name INDEX");
            }
            catch (DecoderFallbackException)
            {
                v.Error(T.CFF_Non_ASCII_String_or_Name, E.CFF_E_Non_ASCII_String_or_Name, m_tag, "Name INDEX");
            }

            try{
                for(uint i = 0; i< String.count; i++)
                {
                    var a = String.GetString(i);
                }

                v.Pass(T.CFF_Non_ASCII_String_or_Name, P.CFF_P_Non_ASCII_String_or_Name, m_tag, "String INDEX");
            }
            catch (DecoderFallbackException)
            {
                v.Error(T.CFF_Non_ASCII_String_or_Name, E.CFF_E_Non_ASCII_String_or_Name, m_tag, "String INDEX");
            }

            for(uint iDICT = 0; iDICT < TopDICT.count; iDICT++)
            {
                Table_CFF.DICTData curTopDICT = null;
                try
                {
                    curTopDICT = GetTopDICT(iDICT);

                    v.Pass(T.CFF_DICTUnwind, P.CFF_P_DICTUnwind, m_tag, curTopDICT.FullName);
//.........这里部分代码省略.........
开发者ID:schriftgestalt,项目名称:Font-Validator,代码行数:101,代码来源:val_CFF.cs

示例15: Validate

        /************************
         * public methods
         */


        public bool Validate(Validator v, OTFontVal fontOwner)
        {
            bool bRet = true;

            if (v.PerformTest(T.hhea_version))
            {
                if (TableVersionNumber.GetUint() == 0x00010000)
                {
                    v.Pass(T.hhea_version, P.hhea_P_version, m_tag);
                }
                else
                {
                    v.Error(T.hhea_version, E.hhea_E_version, m_tag, "0x"+TableVersionNumber.GetUint().ToString("x8"));
                    bRet = false;
                }
            }

            if (v.PerformTest(T.hhea_AscenderPositive))
            {
                if (Ascender <= 0)
                {
                    string s = "Ascender = " + Ascender;
                    v.Error(T.hhea_AscenderPositive, E.hhea_E_AscenderPositive, m_tag, s);
                    bRet = false;
                }
                else
                {
                    v.Pass(T.hhea_AscenderPositive, P.hhea_P_AscenderPositive, m_tag);
                }
            }

            if (v.PerformTest(T.hhea_DescenderNegative))
            {
                if (Descender >= 0)
                {
                    string s = "Descender = " + Descender;
                    v.Error(T.hhea_DescenderNegative, E.hhea_E_DescenderNegative, m_tag, s);
                    bRet = false;
                }
                else
                {
                    v.Pass(T.hhea_DescenderNegative, P.hhea_P_DescenderNegative, m_tag);
                }
            }

            Table_head headTable = (Table_head)fontOwner.GetTable("head");

            if (headTable != null)
            {
                if (v.PerformTest(T.hhea_Ascender_yMax))
                {
                    if (Ascender > headTable.yMax)
                    {
                        string s = "Ascender = " + Ascender + ", head.yMax = " + headTable.yMax;
                        v.Info(T.hhea_Ascender_yMax, I.hhea_I_Ascender_yMax, m_tag, s);
                        // bRet = false;
                    }
                    else
                    {
                        v.Pass(T.hhea_Ascender_yMax, P.hhea_P_Ascender_yMax, m_tag);
                    }
                }

                if (v.PerformTest(T.hhea_Descender_yMin))
                {
                    if (Descender < headTable.yMin)
                    {
                        string s = "Descender = " + Descender + ", head.yMin = " + headTable.yMin;
                        v.Info(T.hhea_Descender_yMin, I.hhea_I_Descender_yMin, m_tag, s);
                        // bRet = false;
                    }
                    else
                    {
                        v.Pass(T.hhea_Descender_yMin, P.hhea_P_Descender_yMin, m_tag);
                    }
                }
            }
            else
            {
                v.Error(T.hhea_Ascender_yMax, E._TEST_E_TableMissing, m_tag, "head");
				bRet = false;
            }

            if (v.PerformTest(T.hhea_LineGapPositive))
            {
                if (LineGap < 0)
                {
                    string s = "LineGap = " + LineGap;
                    v.Warning(T.hhea_LineGapPositive, W.hhea_W_LineGapPositive, m_tag, s);
                    //bRet = false;
                }
                else
                {
                    v.Pass(T.hhea_LineGapPositive, P.hhea_P_LineGapPositive, m_tag);
                }
//.........这里部分代码省略.........
开发者ID:bitforks,项目名称:Font-Validator,代码行数:101,代码来源:val_hhea.cs


注:本文中的OTFontFileVal.Validator.Info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。