本文整理匯總了C#中iTextSharp.text.pdf.RandomAccessFileOrArray.ReadLine方法的典型用法代碼示例。如果您正苦於以下問題:C# RandomAccessFileOrArray.ReadLine方法的具體用法?C# RandomAccessFileOrArray.ReadLine怎麽用?C# RandomAccessFileOrArray.ReadLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.RandomAccessFileOrArray
的用法示例。
在下文中一共展示了RandomAccessFileOrArray.ReadLine方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Process
/** Reads the font metrics
* @param rf the AFM file
* @throws DocumentException the AFM file is invalid
* @throws IOException the AFM file could not be read
*/
virtual public void Process(RandomAccessFileOrArray rf) {
string line;
bool isMetrics = false;
while ((line = rf.ReadLine()) != null) {
StringTokenizer tok = new StringTokenizer(line, " ,\n\r\t\f");
if (!tok.HasMoreTokens())
continue;
string ident = tok.NextToken();
if (ident.Equals("FontName"))
FontName = tok.NextToken("\u00ff").Substring(1);
else if (ident.Equals("FullName"))
FullName = tok.NextToken("\u00ff").Substring(1);
else if (ident.Equals("FamilyName"))
FamilyName = tok.NextToken("\u00ff").Substring(1);
else if (ident.Equals("Weight"))
Weight = tok.NextToken("\u00ff").Substring(1);
else if (ident.Equals("ItalicAngle"))
ItalicAngle = float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("IsFixedPitch"))
IsFixedPitch = tok.NextToken().Equals("true");
else if (ident.Equals("CharacterSet"))
CharacterSet = tok.NextToken("\u00ff").Substring(1);
else if (ident.Equals("FontBBox")) {
llx = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
lly = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
urx = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
ury = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
}
else if (ident.Equals("UnderlinePosition"))
UnderlinePosition = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("UnderlineThickness"))
UnderlineThickness = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("EncodingScheme"))
EncodingScheme = tok.NextToken("\u00ff").Substring(1);
else if (ident.Equals("CapHeight"))
CapHeight = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("XHeight"))
XHeight = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("Ascender"))
Ascender = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("Descender"))
Descender = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("StdHW"))
StdHW = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("StdVW"))
StdVW = (int)float.Parse(tok.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("StartCharMetrics")) {
isMetrics = true;
break;
}
}
if (!isMetrics)
throw new DocumentException(MessageLocalization.GetComposedMessage("missing.startcharmetrics.in.1", fileName));
while ((line = rf.ReadLine()) != null) {
StringTokenizer tok = new StringTokenizer(line);
if (!tok.HasMoreTokens())
continue;
string ident = tok.NextToken();
if (ident.Equals("EndCharMetrics")) {
isMetrics = false;
break;
}
int C = -1;
int WX = 250;
string N = "";
int[] B = null;
tok = new StringTokenizer(line, ";");
while (tok.HasMoreTokens())
{
StringTokenizer tokc = new StringTokenizer(tok.NextToken());
if (!tokc.HasMoreTokens())
continue;
ident = tokc.NextToken();
if (ident.Equals("C"))
C = int.Parse(tokc.NextToken());
else if (ident.Equals("WX"))
WX = (int)float.Parse(tokc.NextToken(), System.Globalization.NumberFormatInfo.InvariantInfo);
else if (ident.Equals("N"))
N = tokc.NextToken();
else if (ident.Equals("B")) {
B = new int[]{int.Parse(tokc.NextToken()),
int.Parse(tokc.NextToken()),
int.Parse(tokc.NextToken()),
int.Parse(tokc.NextToken())};
}
}
Object[] metrics = new Object[]{C, WX, N, B};
if (C >= 0)
CharMetrics[C] = metrics;
CharMetrics[N] = metrics;
}
if (isMetrics)
throw new DocumentException(MessageLocalization.GetComposedMessage("missing.endcharmetrics.in.1", fileName));
if (!CharMetrics.ContainsKey("nonbreakingspace")) {
//.........這裏部分代碼省略.........