本文整理汇总了C#中OTFontFileVal.Validator.Error方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.Error方法的具体用法?C# Validator.Error怎么用?C# Validator.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTFontFileVal.Validator
的用法示例。
在下文中一共展示了Validator.Error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例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: Validate
public bool Validate(Validator v, string sIdentity, OTTable table)
{
bool bRet = true;
if (ClassFormat == 1)
{
ClassDefFormat1_val cdf1 = GetClassDefFormat1_val();
bRet &= cdf1.Validate(v, sIdentity + "(Fmt1)", table);
}
else if (ClassFormat == 2)
{
ClassDefFormat2_val cdf2 = GetClassDefFormat2_val();
bRet &= cdf2.Validate(v, sIdentity + "(Fmt2)", table);
}
else
{
v.Error(T.T_NULL, E._OTL_ClassDefinitionTable_E_Format, table.m_tag, sIdentity + ", format = " + ClassFormat.ToString());
bRet = false;
}
// way too many ClassDefTables to justify this pass message
//if (bRet)
//{
// v.Pass("_OTL_ClassDefinitionTable_P_valid", table.m_tag, sIdentity);
//}
return bRet;
}
示例8: Validate
public bool Validate(Validator v, OTTable table, ushort numGlyphs,
String sIdentity)
{
bool bRet = true;
// check that segCountX2 is even
if ((segCountX2 & 1) == 1)
{
v.Error(T.T_NULL, E.cmap_E_f4_segCountX2, table.m_tag,
sIdentity + ", segCountX2 = " + segCountX2);
bRet = false;
}
// check searchRange
ushort segCount = (ushort)(segCountX2 / 2);
ushort CalculatedSearchRange =
(ushort)(2 * util.MaxPower2LE(segCount));
if (searchRange != CalculatedSearchRange)
{
v.Error(T.T_NULL, E.cmap_E_f4_searchRange, table.m_tag,
sIdentity + ", searchRange = " + searchRange +
", calc = " + CalculatedSearchRange);
bRet = false;
}
// check entrySelector
ushort CalculatedEntrySelector =
util.Log2((ushort)(CalculatedSearchRange/2));
if (entrySelector != CalculatedEntrySelector)
{
v.Error(T.T_NULL, E.cmap_E_f4_entrySelector, table.m_tag,
sIdentity + ", entrySelector = " + entrySelector +
", calc = " + CalculatedEntrySelector);
bRet = false;
}
// check rangeShift
ushort CalculatedRangeShift =
(ushort)(2 * segCount - CalculatedSearchRange);
if (rangeShift != CalculatedRangeShift)
{
v.Error(T.T_NULL, E.cmap_E_f4_rangeShift, table.m_tag,
sIdentity + ", rangeShift = " + rangeShift +
", calc = " + CalculatedRangeShift);
bRet = false;
}
// check that final endCode value is 0xffff
if (GetEndCode((uint)segCount-1) != 0xffff)
{
v.Error(T.T_NULL, E.cmap_E_f4_FinalEndCode, table.m_tag,
sIdentity + ", endCode[" + (segCount-1) + "] = " +
GetEndCode((uint)segCount-1));
bRet = false;
}
// check that end character codes are in ascending order
if (segCount > 1)
{
for (uint i=0; i<segCount-1; i++)
{
if (GetEndCode(i) >= GetEndCode(i+1))
{
v.Error(T.T_NULL, E.cmap_E_f4_EndCodeOrder,
table.m_tag, sIdentity);
bRet = false;
break;
}
}
}
// check that the reservedPad is zero
if ( m_ete.offset + (uint)FieldOffsets.endCode + segCountX2
< m_bufTable.GetLength()
&& reservedPad != 0)
{
v.Error(T.T_NULL, E.cmap_E_f4_reservedPad, table.m_tag,
sIdentity);
bRet = false;
}
// check that each start character code is not greater than
// the corresponding end character code
for (uint i=0; i<segCount; i++)
{
if (GetStartCode(i) > GetEndCode(i))
{
String sDetails = ", startCode[" + i + "] = " +
GetStartCode(i) + " , endCode[" + i + "] = " +
GetEndCode(i);
v.Error(T.T_NULL, E.cmap_E_f4_StartCode_GT_EndCode,
table.m_tag, sIdentity + sDetails);
bRet = false;
}
}
// check that each delta value (where idRangeOffset == 0)
// added to the start code is not negative
for (uint i=0; i<segCount; i++)
{
//.........这里部分代码省略.........
示例9: 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))
//.........这里部分代码省略.........
示例10: 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);
}
//.........这里部分代码省略.........
示例11: 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;
//.........这里部分代码省略.........
示例12: CheckCodePageBit
private bool CheckCodePageBit(int nBit, uint CodePage, string sName, Validator v, OTFont fontOwner)
{
bool bRet = true;
int nTotalChars = 0;
int nMissingChars = 0;
// decode the bit number
bool bBitSet;
if (nBit < 32)
{
bBitSet = ((ulCodePageRange1 & (1<<nBit)) != 0);
}
else
{
bBitSet = ((ulCodePageRange2 & (1<<(nBit-32))) != 0);
}
if (nBit == 31)
{
// symbol character set
Table_cmap cmapTable = (Table_cmap)fontOwner.GetTable("cmap");
if (cmapTable != null)
{
if (cmapTable.GetEncodingTableEntry(3,0) != null)
{
if (!bBitSet)
{
v.Error(T.T_NULL, E.OS_2_E_SymbolBitClear, m_tag);
bRet = false;
}
}
else
{
if (bBitSet)
{
int nPresentChars = 0;
for (ushort c=0xf000; c<= 0xf0ff; c++)
{
if (fontOwner.FastMapUnicodeToGlyphID((char)c) != 0)
{
nPresentChars++;
}
}
if (nPresentChars == 0)
{
v.Error(T.T_NULL, E.OS_2_E_SymbolBitSet, m_tag);
bRet = false;
}
}
}
}
else
{
v.Error(T.T_NULL, E._TEST_E_TableMissing, m_tag, "cmap");
bRet = false;
}
}
else if (CodePage == 0)
{
// reserved field, bit should not be set
if (bBitSet)
{
v.Error(T.T_NULL, E.OS_2_E_ReservedBitSet_CodePage, m_tag, "bit #" + nBit);
bRet = false;
}
}
else
{
try
{
if (MultiByte.IsCodePageInstalled(CodePage))
{
ushort [] arrMissingChars = new ushort[10];
uint nMaxCharSize = MultiByte.GetCodePageMaxCharSize(CodePage);
if (nMaxCharSize == 1)
{
for (ushort c = 0; c<256; c++)
{
// check for special case: MultiByteToWideChar maps char 0xca in CP1255 to U05BA, but CP1255 spec says its not defined
if (CodePage != 1255 || c != 0xca)
{
CheckCodePageGlyph(CodePage, (char)c, ref nTotalChars, ref nMissingChars, arrMissingChars, fontOwner);
}
}
}
else if (nMaxCharSize == 2)
{
bool [] LeadByteMap = new bool[256];
for (int i=0; i<256; i++)
{
LeadByteMap[i] = MultiByte.IsCodePageLeadByte(CodePage, (byte)i);
}
for (ushort c = 0; c<256; c++)
{
if (LeadByteMap[c] == false)
//.........这里部分代码省略.........
示例13: 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;
}
示例14: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.PCLT_TableLength))
{
if (GetLength() == 54)
{
v.Pass(T.PCLT_TableLength, P.PCLT_P_TableLength, m_tag);
}
else
{
v.Error(T.PCLT_TableLength, E.PCLT_E_TableLength, m_tag, GetLength().ToString());
bRet = false;
}
}
if (v.PerformTest(T.PCLT_Version))
{
if (Version.GetUint() == 0x00010000)
{
v.Pass(T.PCLT_Version, P.PCLT_P_Version, m_tag);
}
else
{
v.Error(T.PCLT_Version, E.PCLT_E_Version, m_tag, "0x"+Version.GetUint().ToString("x8"));
bRet = false;
}
}
if (v.PerformTest(T.PCLT_Pitch))
{
Table_hmtx hmtxTable = (Table_hmtx)fontOwner.GetTable("hmtx");
Table_maxp maxpTable = (Table_maxp)fontOwner.GetTable("maxp");
if (hmtxTable == null)
{
v.Error(T.PCLT_Pitch, E._TEST_E_TableMissing, m_tag, "hmtx");
bRet = false;
}
else if (maxpTable == null)
{
v.Error(T.PCLT_Pitch, E._TEST_E_TableMissing, m_tag, "maxp");
bRet = false;
}
else
{
uint iSpaceGlyph = fontOwner.FastMapUnicodeToGlyphID(' ');
if (iSpaceGlyph < fontOwner.GetMaxpNumGlyphs())
{
Table_hmtx.longHorMetric hmSpace = hmtxTable.GetOrMakeHMetric(iSpaceGlyph, fontOwner);
if (hmSpace != null)
{
if (Pitch == hmSpace.advanceWidth)
{
v.Pass(T.PCLT_Pitch, P.PCLT_P_Pitch, m_tag);
}
else
{
string s = "actual = " + Pitch + ", expected = " + hmSpace.advanceWidth;
v.Error(T.PCLT_Pitch, E.PCLT_E_Pitch, m_tag, s);
bRet = false;
}
}
}
else
{
// JJF Figure out what to do
v.Warning(T.PCLT_Pitch, W._TEST_W_ErrorInAnotherTable, m_tag, "can't validate Pitch field, error getting the space glyph");
bRet = false;
}
}
}
if (v.PerformTest(T.PCLT_Style))
{
ushort Posture = (ushort)(Style & 0x0003);
ushort Width = (ushort)((Style>>2) & 0x0007);
ushort Structure = (ushort)((Style>>5) & 0x001f);
ushort Reserved = (ushort)(Style>>10);
bool bBitsOk = true;
if (Posture == 3)
{
v.Error(T.PCLT_Style, E.PCLT_E_Style_Posture, m_tag, "0x"+Style.ToString("x4"));
bBitsOk = false;
bRet = false;
}
if (Width == 5)
{
v.Error(T.PCLT_Style, E.PCLT_E_Style_Width, m_tag, "0x"+Style.ToString("x4"));
bBitsOk = false;
bRet = false;
}
//.........这里部分代码省略.........
示例15: Validate
/************************
* public methods
*/
public bool Validate(Validator v, OTFontVal fontOwner)
{
bool bRet = true;
if (v.PerformTest(T.VDMX_Version))
{
if (version == 0 || version == 1)
{
v.Pass(T.VDMX_Version, P.VDMX_P_Version, m_tag, version.ToString());
}
else
{
v.Error(T.VDMX_Version, E.VDMX_E_Version, m_tag, version.ToString());
bRet = false;
}
}
if (v.PerformTest(T.VDMX_Offsets))
{
bool bOffsetsOk = true;
ushort minPossibleOffset = (ushort)((ushort)FieldOffsets.ratRange + numRatios * 4 + numRatios*2);
ushort maxPossibleOffset = (ushort)GetLength();
for (uint i=0; i<numRatios; i++)
{
ushort offset = GetVdmxGroupOffset(i);
if (offset < minPossibleOffset || offset > maxPossibleOffset)
{
v.Error(T.VDMX_Offsets, E.VDMX_E_InvalidOffset, m_tag, "#" + i + " offset = " + offset);
bOffsetsOk = false;
bRet = false;
}
}
if (bOffsetsOk)
{
v.Pass(T.VDMX_Offsets, P.VDMX_P_Offsets, m_tag);
}
}
if (v.PerformTest(T.VDMX_GroupsInTable))
{
bool bGroupsOk = true;
for (uint i=0; i<numRatios; i++)
{
Vdmx vdmx = GetVdmxGroup(i);
uint EndOffset = (uint)GetVdmxGroupOffset(i) + 4 + (uint)vdmx.recs*6;
if (EndOffset > GetLength())
{
v.Error(T.VDMX_GroupsInTable, E.VDMX_E_GroupsInTable, m_tag, "group# " + i);
bGroupsOk = false;
bRet = false;
}
}
if (bGroupsOk)
{
v.Pass(T.VDMX_GroupsInTable, P.VDMX_P_GroupsInTable, m_tag);
}
}
if (v.PerformTest(T.VDMX_CompareToCalcData))
{
bool bDataOk = true;
bool needtol = false;
RasterInterf.DevMetricsData dmd = null;
try
{
Version ver = fontOwner.GetFile().GetRasterizer().FTVersion;
if ( ver.CompareTo(new Version(2,6,1)) < 0 )
v.Warning(T.VDMX_CompareToCalcData, W.VDMX_W_Need_Newer_FreeType, m_tag,
"Using FreeType Version " + ver + " may not get correct results for VDMX");
dmd = fontOwner.GetCalculatedDevMetrics();
}
catch (InvalidOperationException e)
{
// JJF Figure out what to do. Changed to warning
v.Warning(T.VDMX_CompareToCalcData, W._TEST_W_ErrorInAnotherTable, m_tag, e.Message);
}
catch(Exception e)
{
v.ApplicationError(T.VDMX_CompareToCalcData, E._Table_E_Exception, m_tag, e.Message);
bRet = false;
}
if (dmd != null)
{
for (uint iRatio=0; iRatio<numRatios; iRatio++)
//.........这里部分代码省略.........