示例#1
0
        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);
        }
示例#2
0
        /***************
         * 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;
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 /// <summary>
 /// Create a new <see cref="DescriptorFontFile"/>.
 /// </summary>
 public DescriptorFontFile(IndirectReferenceToken key, FontFileType fileType)
 {
     ObjectKey = key;
     FileType  = fileType;
 }
示例#6
0
        /*****************
        * 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;
            }
        }
示例#7
0
 /// <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;
 }
示例#8
0
 public DescriptorFontFile(IndirectReference key, FontFileType fileType)
 {
     ObjectKey = key;
     FileBytes = new byte[0];
     FileType  = fileType;
 }