本文整理汇总了C#中OTFontFileVal.Validator.Pass方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.Pass方法的具体用法?C# Validator.Pass怎么用?C# Validator.Pass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTFontFileVal.Validator
的用法示例。
在下文中一共展示了Validator.Pass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.VORG_CFF_Font))
{
if (fontOwner.ContainsPostScriptOutlines())
{
v.Pass(T.VORG_CFF_Font, P.VORG_P_CFF_Font, m_tag);
}
else
{
v.Error(T.VORG_CFF_Font, E.VORG_E_CFF_Font, m_tag);
bRet = false;
}
}
if (v.PerformTest(T.VORG_Version))
{
if (majorVersion == 1 && minorVersion == 0)
{
v.Pass(T.VORG_Version, P.VORG_P_Version, m_tag);
}
else
{
v.Error(T.VORG_Version, E.VORG_E_Version, m_tag);
bRet = false;
}
}
return bRet;
}
示例2: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
Table_maxp maxpTable = (Table_maxp)fontOwner.GetTable("maxp");
if (maxpTable == null)
{
v.Error(T.T_NULL, E._TEST_E_TableMissing, m_tag, "Unable to test this table, maxp table is invalid or missing");
return false;
}
if (v.PerformTest(T.vmtx_TableLength))
{
uint CalcTableLength = GetNumOfLongVerMetrics(fontOwner)*4
+ (fontOwner.GetMaxpNumGlyphs() - GetNumOfLongVerMetrics(fontOwner))*2;
if (CalcTableLength == GetLength())
{
v.Pass(T.vmtx_TableLength, P.vmtx_P_TableLength, m_tag);
}
else
{
v.Error(T.vmtx_TableLength, E.vmtx_E_TableLength, m_tag);
bRet = false;
}
}
return bRet;
}
示例3: ValidateNumEntries
public bool ValidateNumEntries(Validator validator,
OTFont fontOwner)
{
int numGlyph=this.NumGlyph(fontOwner);
int numEntry=this.NumEntry(fontOwner);
if ((numGlyph==Table_loca.ValueInvalid)||
(numEntry==Table_loca.ValueInvalid)||
(numEntry!=numGlyph+1))
{
if (validator!=null)
{
validator.Error(T.T_NULL,
E.loca_E_NumEntries,
m_tag,
"number of entries="+numEntry+" number of glyphs="+numGlyph);
}
return false;
}
else
{
if (validator!=null)
{
validator.Pass(P.loca_P_NumEntries, m_tag);
}
return true;
}
}
示例4: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.vhea_version))
{
if (version.GetUint() == 0x00010000 || version.GetUint() == 0x00011000)
{
v.Pass(T.vhea_version, P.vhea_P_version, m_tag, "0x" + version.GetUint().ToString("x8"));
}
else
{
v.Error(T.vhea_version, E.vhea_E_version, m_tag, "0x" + version.GetUint().ToString("x8"));
bRet = false;
}
}
if (v.PerformTest(T.vhea_ReservedFields))
{
if (reserved1 == 0 && reserved2 == 0 && reserved3 == 0 && reserved4 == 0)
{
v.Pass(T.vhea_ReservedFields, P.vhea_P_ReservedFields, m_tag);
}
else
{
v.Error(T.vhea_ReservedFields, E.vhea_E_ReservedFields, m_tag);
bRet = false;
}
}
if (v.PerformTest(T.vhea_metricDataFormat))
{
if (metricDataFormat == 0)
{
v.Pass(T.vhea_metricDataFormat, P.vhea_P_metricDataFormat, m_tag);
}
else
{
v.Error(T.vhea_metricDataFormat, E.vhea_E_metricDataFormat, m_tag, metricDataFormat.ToString());
bRet = false;
}
}
return bRet;
}
示例5: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.cvt_length))
{
if ((m_bufTable.GetLength() & 1) != 0)
{
v.Error(T.cvt_length, E.cvt_E_length_odd, m_tag);
bRet = false;
}
else
{
v.Pass(T.cvt_length, P.cvt_P_length_even, m_tag);
}
}
return bRet;
}
示例6: ValidateFormat
/*
* VALIDATION FUNCTIONS
*/
public bool ValidateFormat(Validator validator,
OTFont fontOwner)
{
int format=this.Format(fontOwner);
if ((format!=0)&&(format!=1))
{
if (validator!=null)
{
validator.Error(E.loca_E_Format, m_tag);
}
return false;
}
else
{
if (validator!=null)
{
validator.Pass(P.loca_P_Format, m_tag);
}
return true;
}
}
示例7: CheckForRequiredTables
protected bool CheckForRequiredTables(Validator v)
{
bool bRet = true;
string [] RequiredTables =
{"cmap", "head", "hhea", "hmtx", "maxp", "name", "OS/2", "post"};
for (int i=0; i<RequiredTables.Length; i++)
{
if (GetDirectoryEntry(RequiredTables[i]) == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, RequiredTables[i]);
bRet = false;
}
}
if (GetDirectoryEntry("glyf") == null && GetDirectoryEntry("CFF ") == null && GetDirectoryEntry("EBDT") == null && GetDirectoryEntry("CBDT") == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, "Font must contain either a 'glyf', 'CFF ', 'EBDT' or 'CBDT' table");
bRet = false;
}
if (GetDirectoryEntry("glyf") != null)
{
string [] RequiredGlyphTables = {"loca"};
for (int i=0; i<RequiredGlyphTables.Length; i++)
{
if (GetDirectoryEntry(RequiredGlyphTables[i]) == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, RequiredGlyphTables[i] + " is required since the font contains a glyf table");
bRet = false;
}
}
}
if (GetDirectoryEntry("EBDT") != null)
{
if (GetDirectoryEntry("EBLC") == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, "EBLC is required since the font contains an EBDT table");
bRet = false;
}
}
if (GetDirectoryEntry("EBLC") != null)
{
if (GetDirectoryEntry("EBDT") == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, "EBDT is required since the font contains an EBLC table");
bRet = false;
}
}
if (GetDirectoryEntry("EBSC") != null)
{
if (GetDirectoryEntry("EBDT") == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, "EBDT is required since the font contains an EBSC table");
bRet = false;
}
if (GetDirectoryEntry("EBLC") == null)
{
v.Error(T.T_NULL, E._FONT_E_MissingRequiredTable, null, "EBLC is required since the font contains an EBSC table");
bRet = false;
}
}
if (bRet)
{
v.Pass(P._FONT_P_MissingRequiredTable, null);
}
return bRet;
}
示例8: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
ushort numGlyphs = GetNumGlyphs(fontOwner);
if (v.PerformTest(T.hdmx_Version))
{
if (TableVersionNumber == 0)
{
v.Pass(T.hdmx_Version, P.hdmx_P_Version, m_tag);
}
else
{
v.Error(T.hdmx_Version, E.hdmx_E_Version, m_tag, TableVersionNumber.ToString());
bRet = false;
}
}
bool bNumDeviceRecordsOk = true;
if (v.PerformTest(T.hdmx_NumDeviceRecords))
{
if (NumberDeviceRecords >= 0)
{
v.Pass(T.hdmx_NumDeviceRecords, P.hdmx_P_NumDeviceRecords, m_tag, NumberDeviceRecords.ToString());
}
else
{
v.Error(T.hdmx_NumDeviceRecords, E.hdmx_E_NumDeviceRecords_neg, m_tag, NumberDeviceRecords.ToString());
bNumDeviceRecordsOk = false;
bRet = false;
}
}
bool bSizeOk = true;
if (v.PerformTest(T.hdmx_SizeofDeviceRecord))
{
if ((SizeofDeviceRecord & 3) != 0)
{
v.Error(T.hdmx_SizeofDeviceRecord, E.hdmx_E_SizeofDeviceRecord_alignment, m_tag, SizeofDeviceRecord.ToString());
bSizeOk = false;
bRet = false;
}
uint CalculatedSizeofDeviceRecord = CalculateSizeofDeviceRecord(numGlyphs);
if (SizeofDeviceRecord != CalculatedSizeofDeviceRecord)
{
string s = "actual = " + SizeofDeviceRecord + ", calc = " + CalculatedSizeofDeviceRecord;
v.Error(T.hdmx_SizeofDeviceRecord, E.hdmx_E_SizeofDeviceRecord_numGlyphs, m_tag, s);
bSizeOk = false;
bRet = false;
}
if (bSizeOk)
{
v.Pass(T.hdmx_SizeofDeviceRecord, P.hdmx_P_SizeofDeviceRecord, m_tag, SizeofDeviceRecord.ToString());
}
}
bool bLengthOk = true;
if (v.PerformTest(T.hdmx_TableLength))
{
if (bNumDeviceRecordsOk)
{
uint CalculatedTableLength = 8 + (uint)NumberDeviceRecords * CalculateSizeofDeviceRecord(numGlyphs);
if (GetLength() == CalculatedTableLength)
{
v.Pass(T.hdmx_TableLength, P.hdmx_P_TableLength, m_tag);
}
else
{
string s = "actual: " + GetLength() + ", calc: " + CalculatedTableLength;
v.Error(T.hdmx_TableLength, E.hdmx_E_TableLength, m_tag, s);
bLengthOk = false;
bRet = false;
}
}
else
{
v.Warning(T.hdmx_TableLength, W._TEST_W_OtherErrorsInTable, m_tag, "unable to validate table length");
}
}
if (v.PerformTest(T.hdmx_DeviceRecordPadBytesZero))
{
if (bSizeOk && bLengthOk & bNumDeviceRecordsOk)
{
uint unpaddedLength = (uint)numGlyphs + 2;
if ((unpaddedLength & 3) == 0)
{
v.Pass(T.hdmx_DeviceRecordPadBytesZero, P.hdmx_P_DeviceRecordPadBytes_none, m_tag);
}
//.........这里部分代码省略.........
示例9: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.OS_2_Version))
{
if (version == 0 || version == 1 || version == 2)
{
v.Warning(T.OS_2_Version, W.OS_2_W_Version_old, m_tag, version.ToString());
}
else if (version == 3)
{
v.Pass(T.OS_2_Version, P.OS_2_P_Version, m_tag, version.ToString());
}
else
{
v.Error(T.OS_2_Version, E.OS_2_E_Version, m_tag, version.ToString());
bRet = false;
}
}
if (v.PerformTest(T.OS_2_TableLength))
{
uint len = GetLength();
if ((version == 0 && len == 78)
|| (version == 1 && len == 86)
|| (version == 2 && len == 96)
|| (version == 3 && len == 96))
{
v.Pass(T.OS_2_TableLength, P.OS_2_P_TableLength, m_tag);
}
else
{
v.Error(T.OS_2_TableLength, E.OS_2_E_TableLength, m_tag);
bRet = false;
}
}
if (!bRet)
{
v.Warning(T.T_NULL, W._TEST_W_OtherErrorsInTable, m_tag, "OS/2 table appears to be corrupt. No further tests will be performed.");
return bRet;
}
if (v.PerformTest(T.OS_2_xAvgCharWidth))
{
if (fontOwner.GetTable("maxp") == null)
{
v.Warning(T.OS_2_xAvgCharWidth, W._TEST_W_ErrorInAnotherTable, m_tag, "maxp table inaccessible, can't check Avg Char Width");
}
else
{
if (fontOwner.ContainsTrueTypeOutlines())
{
Table_hmtx hmtxTable = (Table_hmtx)fontOwner.GetTable("hmtx");
val_loca locaTable = (val_loca)fontOwner.GetTable("loca");
val_maxp maxpTable = (val_maxp)fontOwner.GetTable("maxp");
if (hmtxTable == null)
{
v.Error(T.OS_2_xAvgCharWidth, E._TEST_E_TableMissing, m_tag, "hmtx");
bRet = false;
}
else if (locaTable == null)
{
v.Error(T.OS_2_xAvgCharWidth, E._TEST_E_TableMissing, m_tag, "loca");
bRet = false;
}
else if (maxpTable == null)
{
v.Error(T.OS_2_xAvgCharWidth, E._TEST_E_TableMissing, m_tag, "maxp");
bRet = false;
}
else
{
if ( version == 3
|| fontOwner.ContainsMsSymbolEncodedCmap())
{
int nTotalWidth = 0;
int nTotalGlyphs = 0;
for (uint iGlyph=0; iGlyph<fontOwner.GetMaxpNumGlyphs(); iGlyph++)
{
Table_hmtx.longHorMetric hm = hmtxTable.GetOrMakeHMetric(iGlyph, fontOwner);
if (hm != null)
{
nTotalWidth += hm.advanceWidth;
// only average non-zero width glyphs
if (hm.advanceWidth > 0)
{
nTotalGlyphs ++;
}
}
}
short CalcAvgWidth = 0;
//.........这里部分代码省略.........
示例10: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.head_TableLength))
{
if (m_bufTable.GetLength() == 54)
{
v.Pass(T.head_TableLength, P.head_P_TableLength, m_tag);
}
else
{
v.Error(T.head_TableLength, E.head_E_TableLength, m_tag, m_bufTable.GetLength().ToString());
bRet = false;
}
}
if (v.PerformTest(T.head_TableVersion))
{
if (TableVersionNumber.GetUint() == 0x00010000)
{
v.Pass(T.head_TableVersion, P.head_P_TableVersion, m_tag);
}
else
{
v.Error(T.head_TableVersion, E.head_E_TableVersion, m_tag, "0x"+TableVersionNumber.GetUint().ToString("x8"));
bRet = false;
}
}
if (v.PerformTest(T.head_fontRevision))
{
string sVersion = fontOwner.GetFontVersion();
if (sVersion != null)
{
if (sVersion.Length >= 11
&& sVersion.StartsWith("Version ")
&& Char.IsDigit(sVersion, 8))
{
string sVersionNum = sVersion.Substring(8);
bool bFoundDecPt = false;
int nLastDigitPos = 0;
for (int i=0; i<sVersionNum.Length; i++)
{
if (Char.IsDigit(sVersionNum, i))
{
nLastDigitPos = i;
}
else if (sVersionNum[i] == '.')
{
if (!bFoundDecPt)
{
bFoundDecPt = true;
}
else
{
break;
}
}
else
{
break;
}
}
double fVersion = Double.Parse(sVersionNum.Substring(0, nLastDigitPos+1));
double fRevision = fontRevision.GetDouble();
if (Math.Round(fVersion, 3) == Math.Round(fRevision, 3))
{
v.Pass(T.head_fontRevision, P.head_P_fontRevision, m_tag, fRevision.ToString("f3"));
}
else
{
string s = "revision: " + fRevision.ToString("f3") + ", version: " + sVersionNum;
v.Warning(T.head_fontRevision, W.head_W_fontRevision, m_tag, s);
}
}
}
}
if (v.PerformTest(T.head_ChecksumAdjustment))
{
if (checkSumAdjustment == 0xb1b0afba - fontOwner.CalcChecksum())
{
v.Pass(T.head_ChecksumAdjustment, P.head_P_FontChecksum, m_tag, "0x"+checkSumAdjustment.ToString("x8"));
}
else
{
v.Error(T.head_ChecksumAdjustment, E.head_E_FontChecksum, m_tag, "0x"+checkSumAdjustment.ToString("x8"));
bRet = false;
}
}
if (v.PerformTest(T.head_MagicNumber))
//.........这里部分代码省略.........
示例11: Validate
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.cmap_Version))
{
if (TableVersionNumber == 0)
{
v.Pass(T.cmap_Version, P.cmap_P_version, m_tag);
}
else
{
v.Error(T.cmap_Version, E.cmap_E_version, m_tag,
TableVersionNumber.ToString());
bRet = false;
}
}
// Check that the number of encoding records seems to
// agree with the numTables field, and that each offset
// is greater than 0 and less than the length of the cmap
// table.
bool bOffsetsOk = true;
if (v.PerformTest(T.cmap_SubtableOffset))
{
for (uint i=0; i<NumberOfEncodingTables; i++)
{
EncodingTableEntry ete = GetEncodingTableEntry(i);
if (ete != null)
{
if (ete.offset == 0)
{
v.Error(T.cmap_SubtableOffset,
E.cmap_E_SubtableOffset_zero, m_tag,
"encoding table entry index = " +
i.ToString() + ", platformID = " +
ete.platformID + ", encodingID = " +
ete.encodingID);
bRet = false;
bOffsetsOk = false;
}
if (ete.offset > m_bufTable.GetLength())
{
v.Error(T.cmap_SubtableOffset,
E.cmap_E_SubtableOffset_eot, m_tag,
"encoding table entry index = " +
i.ToString() + ", platformID = " +
ete.platformID +
", encodingID = " + ete.encodingID);
bRet = false;
bOffsetsOk = false;
}
}
else
{
v.Warning(T.cmap_SubtableOffset,
W._TEST_W_OtherErrorsInTable, m_tag,
"cmap table appears to be corrupt. " +
" No further tests will be performed.");
return bRet;
}
}
if (bOffsetsOk)
{
v.Pass(T.cmap_SubtableOffset, P.cmap_P_SubtableOffset,
m_tag);
}
}
// Check that each subtable can be retrieved from the font
// and that its offset + length lies within the cmap.
bool bLengthsOk = true;
if (v.PerformTest(T.cmap_SubtableLength))
{
for (uint i=0; i<NumberOfEncodingTables; i++)
{
EncodingTableEntry ete = GetEncodingTableEntry(i);
Subtable st = GetSubtable(ete);
if (st != null)
{
if (st.length == 0)
{
v.Error(T.cmap_SubtableLength,
E.cmap_E_SubtableLength_zero, m_tag,
i.ToString());
bRet = false;
bLengthsOk = false;
}
if (ete.offset + st.length > m_bufTable.GetLength())
{
v.Error(T.cmap_SubtableLength,
E.cmap_E_SubtableLength_eot, m_tag,
//.........这里部分代码省略.........
示例12: Validate
public bool Validate(Validator v, string sIdentity, OTTable table)
{
bool bRet = true;
bool bFeatureListOk = true;
// check the FeatureRecord array length
if (m_offsetFeatureListTable + (uint)FieldOffsets.FeatureRecordArray + FeatureCount*6 > m_bufTable.GetLength())
{
v.Error(T.T_NULL, E._OTL_FeatureListTable_E_FeatureRecordArray_pastEOT, table.m_tag, sIdentity);
bFeatureListOk = false;
bRet = false;
}
// check that the FeatureRecord array is sorted alphabetically
if (FeatureCount > 1)
{
for (uint i=0; i<FeatureCount-1; i++)
{
FeatureRecord frCurr = GetFeatureRecord(i);
FeatureRecord frNext = GetFeatureRecord(i+1);
if (frCurr.FeatureTag > frNext.FeatureTag)
{
v.Error(T.T_NULL, E._OTL_FeatureListTable_E_FeatureRecordArray_order, table.m_tag, sIdentity);
bFeatureListOk = false;
bRet = false;
break;
}
}
}
// check each FeatureRecord
for (uint i=0; i<FeatureCount; i++)
{
FeatureRecord fr = GetFeatureRecord(i);
if (fr != null)
{
// check tag
if (!fr.FeatureTag.IsValid())
{
v.Error(T.T_NULL, E._OTL_FeatureListTable_E_FeatureRecord_tag, table.m_tag, sIdentity + ", FeatureRecord[" + i + "]");
bFeatureListOk = false;
bRet = false;
}
else if (!IsKnownFeatureTag(fr.FeatureTag))
{
v.Warning(T.T_NULL, W._OTL_FeatureListTable_W_FeatureRecord_tag, table.m_tag, sIdentity + ", FeatureRecord[" + i + "], tag = '" + fr.FeatureTag + "'");
}
// check offset
if (m_offsetFeatureListTable + fr.FeatureTableOffset > m_bufTable.GetLength())
{
v.Error(T.T_NULL, E._OTL_FeatureListTable_E_FeatureRecord_offset, table.m_tag, sIdentity + ", FeatureRecord[" + i + "]");
bFeatureListOk = false;
bRet = false;
}
else
{
// validate the feature table
FeatureTable_val ft = GetFeatureTable_val(fr);
bRet &= ft.Validate(v, sIdentity + ", FeatureRecord[" + i + "]" + "(" + (string)fr.FeatureTag + ")" + ", FeatureTable", table);
}
}
else
{
bFeatureListOk = false;
bRet = false;
}
}
if (bFeatureListOk)
{
v.Pass(T.T_NULL, P._OTL_FeatureListTable_P_valid, table.m_tag, sIdentity);
}
return bRet;
}
示例13: CheckForRecommendedTables
protected bool CheckForRecommendedTables(Validator v)
{
bool bRet = true;
bool bMissing = false;
if (!IsPostScript())
{
if (GetDirectoryEntry("gasp") == null)
{
v.Warning(T.T_NULL, W._FONT_W_MissingRecommendedTable, null, "gasp");
bMissing = true;
}
Table_hmtx hmtxTable = (Table_hmtx)GetTable("hmtx");
if (hmtxTable != null)
{
if (!hmtxTable.IsMonospace(this) && !ContainsSymbolsOnly())
{
if (GetDirectoryEntry("kern") == null)
{
v.Warning(T.T_NULL, W._FONT_W_MissingRecommendedTable, null, "kern");
bMissing = true;
}
if (GetDirectoryEntry("hdmx") == null)
{
v.Warning(T.T_NULL, W._FONT_W_MissingRecommendedTable, null, "hdmx");
bMissing = true;
}
}
}
if (GetDirectoryEntry("VDMX") == null)
{
v.Warning(T.T_NULL, W._FONT_W_MissingRecommendedTable, null, "VDMX");
bMissing = true;
}
}
if (GetDirectoryEntry("DSIG") == null)
{
v.Warning(T.T_NULL, W._FONT_W_MissingRecommendedTable, null, "DSIG");
bMissing = true;
}
if (!bMissing)
{
v.Pass(P._FONT_P_MissingRecommendedTable, null);
}
return bRet;
}
示例14: CheckForOptimalTableOrder
protected bool CheckForOptimalTableOrder(Validator v)
{
bool bRet = true;
if (!GetFile().IsCollection()) // don't perform this test on .ttc files
{
string [] OrderedTables = null;
string [] TTOrderedTables =
{
"head", "hhea", "maxp", "OS/2", "hmtx", "LTSH", "VDMX",
"hdmx", "cmap", "fpgm", "prep", "cvt ", "loca", "glyf",
"kern", "name", "post", "gasp", "PCLT" /*"DSIG"*/
};
string [] PSOrderedTables =
{
"head", "hhea", "maxp", "OS/2", "name", "cmap", "post", "CFF "
};
if (ContainsTrueTypeOutlines())
{
OrderedTables = TTOrderedTables;
}
else if (ContainsPostScriptOutlines())
{
OrderedTables = PSOrderedTables;
}
if (OrderedTables != null)
{
Debug.Assert(m_OffsetTable != null);
bool bOrderOk = true;
if (m_OffsetTable != null)
{
for (int i=0; i<OrderedTables.Length-1; i++)
{
for (int j=i+1; j<OrderedTables.Length; j++)
{
DirectoryEntry deBefore = GetDirectoryEntry(OrderedTables[i]);
DirectoryEntry deAfter = GetDirectoryEntry(OrderedTables[j]);
if (deBefore != null && deAfter != null)
{
if (deBefore.offset > deAfter.offset)
{
string sDetails = "table '" + deAfter.tag + "' precedes table '" + deBefore.tag + "'";
v.Warning(T.T_NULL, W._FONT_W_OptimalOrder, null, sDetails);
bOrderOk = false;
break;
}
}
}
if (!bOrderOk)
{
break;
}
}
}
if (bOrderOk)
{
v.Pass(P._FONT_P_OptimalOrder, null);
}
}
}
return bRet;
}
示例15: CheckForNoUnnecessaryTables
protected bool CheckForNoUnnecessaryTables(Validator v)
{
bool bRet = true;
bool bFoundUnnecessary = false;
Table_hmtx hmtxTable = (Table_hmtx)GetTable("hmtx");
if (hmtxTable != null)
{
if (hmtxTable.IsMonospace(this))
{
if (GetDirectoryEntry("hdmx") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "hdmx table not needed for monospaced font");
bFoundUnnecessary = true;
}
if (GetDirectoryEntry("LTSH") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "LTSH table not needed for monospaced font");
bFoundUnnecessary = true;
}
if (GetDirectoryEntry("kern") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "kern table not needed for monospaced font");
bFoundUnnecessary = true;
}
}
if (GetDirectoryEntry("CFF ") == null && GetDirectoryEntry("VORG") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "VORG table not needed, it may optionally be present for fonts with Postscript outlines");
bFoundUnnecessary = true;
}
if (GetDirectoryEntry("PCLT") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "PCLT table not needed, Microsoft no longer recommends including this table");
bFoundUnnecessary = true;
}
}
if (GetDirectoryEntry("CFF ") != null)
{
string [] UnnecessaryTables = {"glyf", "fpgm", "cvt ", "loca", "prep"};
for (int i=0; i<UnnecessaryTables.Length; i++)
{
if (GetDirectoryEntry(UnnecessaryTables[i]) != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, UnnecessaryTables[i] + " not needed since the font contains a 'CFF ' table");
bFoundUnnecessary = true;
}
}
}
if (GetDirectoryEntry("glyf") != null)
{
if (GetDirectoryEntry("CFF ") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "CFF not needed since the font contains a 'CFF ' table");
bFoundUnnecessary = true;
}
}
if (ContainsLatinOnly())
{
if (GetDirectoryEntry("vhea") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "vhea not needed since the font only contains Latin characters");
bFoundUnnecessary = true;
}
if (GetDirectoryEntry("vmtx") != null)
{
v.Warning(T.T_NULL, W._FONT_W_UnnecessaryTable, null, "vmtx not needed since the font only contains Latin characters");
bFoundUnnecessary = true;
}
}
if (!bFoundUnnecessary)
{
v.Pass(P._FONT_P_UnnecessaryTable, null);
}
return bRet;
}