Пример #1
0
            public override OTTable GenerateTable()
            {
                // create a Motorola Byte Order buffer for the new table
                MBOBuffer newbuf;
                uint nSizeOfIndexAndNames = 0;                

                if( m_Version.GetUint() == 0x00020000 )
                {
                    uint nSizeOfByteArray = 0;
    
                    // Get what the size of the byte array will be
                    for(int i = 0; i < m_names.Count; i++ )
                    {
                        nSizeOfByteArray += (uint)(((string)m_names[i]).Length + 1); 
                    }                    

                    // Add 2 for the ushort numberOfGlyphs
                    nSizeOfIndexAndNames = (uint)(2 + (m_numberOfGlyphs * 2) + nSizeOfByteArray);                    

                }

                newbuf = new MBOBuffer(32 + nSizeOfIndexAndNames);

                newbuf.SetFixed( m_Version, (uint)Table_post.FieldOffsets.Version );
                newbuf.SetFixed( m_italicAngle, (uint)Table_post.FieldOffsets.italicAngle );
                newbuf.SetShort( m_underlinePosition, (uint)Table_post.FieldOffsets.underlinePosition );
                newbuf.SetShort( m_underlineThickness, (uint)Table_post.FieldOffsets.underlineThickness );
                newbuf.SetUint( m_isFixedPitch, (uint)Table_post.FieldOffsets.isFixedPitch );
                newbuf.SetUint( m_minMemType42, (uint)Table_post.FieldOffsets.minMemType42 );
                newbuf.SetUint( m_maxMemType42, (uint)Table_post.FieldOffsets.maxMemType42 );
                newbuf.SetUint( m_minMemType1, (uint)Table_post.FieldOffsets.minMemType1);
                newbuf.SetUint( m_maxMemType1, (uint)Table_post.FieldOffsets.maxMemType1);                


                if( m_Version.GetUint() == 0x00020000 )
                {
                    newbuf.SetUshort( m_numberOfGlyphs, (uint)Table_post.FieldOffsetsVer2.numberOfGlyphs);    

                    uint nOffset = (uint)Table_post.FieldOffsetsVer2.glyphNameIndex;
                    for( int i = 0; i < m_numberOfGlyphs; i++ )
                    {
                        newbuf.SetUshort( (ushort)m_glyphNameIndex[i], nOffset );
                        nOffset += 2;
                    }

                    // write out the names to the buffer in length followed by character bytes
                    for( int i = 0; i < m_names.Count; i++ )
                    {
                        string sName = (string)m_names[i];
                        newbuf.SetByte( (byte)sName.Length,      nOffset );
                        nOffset++;

                        for( int ii = 0; ii < sName.Length; ii++ )
                        {
                            newbuf.SetByte( (byte)sName[ii],      nOffset );
                            nOffset++;
                        }
                    }                
                }
                
                
                // put the buffer into a Table_maxp object and return it
                Table_post postTable = new Table_post("post", newbuf);

                return postTable;            
            }
Пример #2
0
        public virtual OTTable CreateTableObject(OTTag tag, MBOBuffer buf)
        {
            OTTable table = null;

            string sName = GetUnaliasedTableName(tag);

            switch (sName)
            {
                case "BASE": table = new Table_BASE(tag, buf); break;
                case "CFF ": table = new Table_CFF(tag, buf); break;
                case "cmap": table = new Table_cmap(tag, buf); break;
                case "cvt ": table = new Table_cvt(tag, buf); break;
                case "DSIG": table = new Table_DSIG(tag, buf); break;
                case "EBDT": table = new Table_EBDT(tag, buf); break;
                case "EBLC": table = new Table_EBLC(tag, buf); break;
                case "EBSC": table = new Table_EBSC(tag, buf); break;
                case "fpgm": table = new Table_fpgm(tag, buf); break;
                case "gasp": table = new Table_gasp(tag, buf); break;
                case "GDEF": table = new Table_GDEF(tag, buf); break;
                case "glyf": table = new Table_glyf(tag, buf); break;
                case "GPOS": table = new Table_GPOS(tag, buf); break;
                case "GSUB": table = new Table_GSUB(tag, buf); break;
                case "hdmx": table = new Table_hdmx(tag, buf); break;
                case "head": table = new Table_head(tag, buf); break;
                case "hhea": table = new Table_hhea(tag, buf); break;
                case "hmtx": table = new Table_hmtx(tag, buf); break;
                case "JSTF": table = new Table_JSTF(tag, buf); break;
                case "kern": table = new Table_kern(tag, buf); break;
                case "loca": table = new Table_loca(tag, buf); break;
                case "LTSH": table = new Table_LTSH(tag, buf); break;
                case "maxp": table = new Table_maxp(tag, buf); break;
                case "name": table = new Table_name(tag, buf); break;
                case "OS/2": table = new Table_OS2(tag, buf); break;
                case "PCLT": table = new Table_PCLT(tag, buf); break;
                case "post": table = new Table_post(tag, buf); break;
                case "prep": table = new Table_prep(tag, buf); break;
                case "VDMX": table = new Table_VDMX(tag, buf); break;
                case "vhea": table = new Table_vhea(tag, buf); break;
                case "vmtx": table = new Table_vmtx(tag, buf); break;
                case "VORG": table = new Table_VORG(tag, buf); break;
                //case "Zapf": table = new Table_Zapf(tag, buf); break;
                default: table = new Table__Unknown(tag, buf); break;
            }

            return table;
        }
Пример #3
0
            protected char[] m_offset; // v2.5 NOTE: We may not need? so not supported yet

            // constructor
            public post_cache(Table_post OwnerTable)
            {
                m_Version = OwnerTable.Version;
                m_italicAngle = OwnerTable.italicAngle;
                m_underlinePosition = OwnerTable.underlinePosition;
                m_underlineThickness = OwnerTable.underlineThickness;
                m_isFixedPitch = OwnerTable.isFixedPitch;
                m_minMemType42 = OwnerTable.minMemType42;
                m_maxMemType42 = OwnerTable.maxMemType42;
                m_minMemType1 = OwnerTable.minMemType1;
                m_maxMemType1 = OwnerTable.maxMemType1;

                // NOTE: what about version 2.5 is that covered with this check?
                // NOTE: Are we not checking because it is deprecated?
                if( m_Version.GetUint() == 0x00020000 )
                {
                    m_numberOfGlyphs = OwnerTable.numberOfGlyphs;
                    m_glyphNameIndex = new ArrayList( m_numberOfGlyphs );

                    for( ushort i = 0; i < m_numberOfGlyphs; i++ )
                    {
                        m_glyphNameIndex.Add( OwnerTable.GetGlyphNameIndex( i ));
                    }

                    m_names = new ArrayList( (int)OwnerTable.NumberOfStrings );

                    // Get the gyph names
                    for( uint i = 0; i < OwnerTable.NumberOfStrings; i++ )
                    {
                        m_names.Add( OwnerTable.GetNameString( i ));
                    }
                }

            }