protected FontFileType Identify() { Debug.Assert(m_fs != null); FontFileType fft = FontFileType.INVALID; // read the first four bytes in the file MBOBuffer buf = ReadPaddedBuffer(0, 4); if (buf != null) { OTTag tag = new OTTag(buf.GetBuffer()); if (IsValidSfntVersion(tag)) { fft = FontFileType.SINGLE; } else if ((string)tag == "ttcf") { fft = FontFileType.COLLECTION; } } return(fft); }
/*************** * constructors */ /// <summary>Construct empty object except for <c>TableManager</c> /// </summary> public OTFile() { m_TableManager = new TableManager(this); m_FontFileType = FontFileType.INVALID; m_nFonts = 0; m_ttch = null; }
internal bool Analyze( [Out] out FontFileType fontFileType, [Out] out FontFaceType fontFaceType, [Out] out uint numberOfFaces, [Out] out int hr) { bool isSupported = false; hr = _fontFile.Analyze(out isSupported, out fontFileType, out fontFaceType, out numberOfFaces); return(isSupported); }
internal bool Analyze( [Out] out FontFileType fontFileType, [Out] out FontFaceType fontFaceType, [Out] out uint numberOfFaces) { bool isSupported = false; int hr; isSupported = Analyze(out fontFileType, out fontFaceType, out numberOfFaces, out hr); Marshal.ThrowExceptionForHR(hr); return(isSupported); }
/// <summary> /// Create a new <see cref="DescriptorFontFile"/>. /// </summary> public DescriptorFontFile(IndirectReferenceToken key, FontFileType fileType) { ObjectKey = key; FileType = fileType; }
/***************** * private methods */ private bool TestFileType() { m_FontFileType = Identify(); switch (m_FontFileType) { case FontFileType.INVALID: close(); return false; case FontFileType.SINGLE: m_ttch = null; m_nFonts = 1; return true; case FontFileType.COLLECTION: m_ttch = TTCHeader.ReadTTCHeader(this); if (m_ttch != null) { m_nFonts = m_ttch.DirectoryCount; } else { m_nFonts = 0; } return true; default: close(); return false; } }
/// <summary>Close filestream and set type to file type to /// invalid.</summary> public void close() { if (m_fs != null) { m_fs.Close(); m_fs = null; } m_TableManager = new TableManager(this); // JJF: Why? m_FontFileType = FontFileType.INVALID; m_ttch = null; m_nFonts = 0; }
public DescriptorFontFile(IndirectReference key, FontFileType fileType) { ObjectKey = key; FileBytes = new byte[0]; FileType = fileType; }