/// <summary>Creates the character metrics object.</summary> /// <param name="type1FontData">Type1 font data object</param> /// <param name="sLine">Line with the character metrics information</param> internal CharMetrics(OpenTypeFontData openTypeFontData, String sLine) { #if WindowsCE String[] asLineToken = sLine.Split(acDelimiterSemicolon); #else String[] asLineToken = sLine.Split(acDelimiterSemicolon, 10); #endif if (asLineToken.Length <= 2) { throw new ReportException("Invalid character metrics definition in AFM file: " + openTypeFontData.sFontName); } for (Int32 iExpr = 0; iExpr < asLineToken.Length; iExpr++) { if (asLineToken[iExpr].Length == 0) { continue; } #if WindowsCE String[] asToken = asLineToken[iExpr].Trim().Split(acDelimiterToken); #else String[] asToken = asLineToken[iExpr].Trim().Split(acDelimiterToken, 5); #endif switch (asToken[0]) { case "C": { iCharacterCode = Int32.Parse(asToken[1], CultureInfo.InvariantCulture); break; } case "CH": { iCharacterCode = Int32.Parse(asToken[1], System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture); break; } case "WX": case "W0X": { fWidthX = Single.Parse(asToken[1], CultureInfo.InvariantCulture); break; } case "N": { sName = asToken[1]; break; } case "B": { fBBox_llx = Single.Parse(asToken[1], CultureInfo.InvariantCulture); fBBox_lly = Single.Parse(asToken[2], CultureInfo.InvariantCulture); fBBox_urx = Single.Parse(asToken[3], CultureInfo.InvariantCulture); fBBox_ury = Single.Parse(asToken[4], CultureInfo.InvariantCulture); break; } case "L": { if (al_Ligature == null) { al_Ligature = new ArrayList(10); } al_Ligature.Add(new Ligature(asToken[1], asToken[2])); break; } default: { Debug.Fail("Unknown token [" + asToken[0] + "] in AFM file: " + openTypeFontData.sFontName); break; } } } }
//------------------------------------------------------------------------------------------01.02.2006 /// <summary>Writes the object to the buffer.</summary> internal override void Write() { OpenTypeFontData openTypeFontData = (OpenTypeFontData)fontData; StartObj(); Dictionary_Start(); Dictionary_Key("Type"); Name("Font"); Dictionary_Key("Subtype"); Name("TrueType"); System.Diagnostics.Debug.Assert(openTypeFontData.sBaseFontName != null); Dictionary_Key("BaseFont"); Name(openTypeFontData.sBaseFontName); Dictionary_Key("Encoding"); Name("WinAnsiEncoding"); Dictionary_Key("FontDescriptor"); IndirectReference(pdfIndirectObject_FontDescriptor); Int32 iFirstChar = openTypeFontData.iFirstChar; Dictionary_Key("FirstChar"); Number(iFirstChar); Int32 iLastChar = openTypeFontData.iLastChar; Dictionary_Key("LastChar"); Number(iLastChar); Dictionary_Key("Widths"); ArrayStart(); for (int i = iFirstChar; i <= iLastChar; i++) { Space(); Int32 iWidth = openTypeFontData.iGetRawWidth(iFirstChar + i); Number(iWidth); } ArrayEnd(); Dictionary_End(); EndObj(); }
//------------------------------------------------------------------------------------------06.03.2005 /// <summary>Gets the font data object that is identified by the specified style.</summary> /// <param name="fontStyle">Style value that identifies the font data object</param> /// <value>Font data object that is identified by the specified style</value> /// <remarks>If there is no font data object with the specified style, <see langword="null"/> will be returned.</remarks> internal FontData this[FontStyle fontStyle] { get { Int32 i = (Int32)fontStyle; FontData fontData = aFontData[i]; if (fontData == null) { if (fontDef.fontType == FontType.InternalAFM) { fontData = new Type1FontData(fontDef, fontDef.sFontName, fontStyle); } else { fontData = new OpenTypeFontData(fontDef, fontStyle); } aFontData[i] = fontData; } return(fontData); } }
//------------------------------------------------------------------------------------------04.05.2006 /// <summary>Creates a font descriptor indirect object.</summary> /// <param name="pdfFormatter">PDF formatter</param> /// <param name="fontProp">Font property</param> internal PdfIndirectObject_FontDescriptor(PdfFormatter pdfFormatter, OpenTypeFontData openTypeFontData) : base(pdfFormatter) { this.openTypeFontData = openTypeFontData; }
//------------------------------------------------------------------------------------------04.08.2006 /// <summary>Creates a font indirect object for an open type font.</summary> /// <param name="pdfFormatter">PDF formatter</param> /// <param name="openTypeFontData">Open type font data</param> internal PdfIndirectObject_Font_OpenType(PdfFormatter pdfFormatter, OpenTypeFontData openTypeFontData) : base(pdfFormatter, openTypeFontData) { pdfIndirectObject_FontDescriptor = new PdfIndirectObject_FontDescriptor(pdfFormatter, openTypeFontData); }