Exemple #1
0
            public override OTTable GenerateTable()
            {
                uint   iSizeOfTables = 0;
                ushort nLeft         = 0;
                ushort nRight        = 0;
                short  nValue        = 0;

                // Find the sizeof all of the tables
                for (ushort i = 0; i < m_nTables; i++)
                {
                    iSizeOfTables += (uint)((SubTableFormat0)m_SubTable[i]).CalculatedLength();
                }

                // create a Motorola Byte Order buffer for the new table
                MBOBuffer newbuf = new MBOBuffer((uint)FieldOffsets.FirstSubTableHeader + iSizeOfTables);

                newbuf.SetUshort(m_version, (uint)FieldOffsets.version);
                newbuf.SetUshort(m_nTables, (uint)FieldOffsets.nTables);

                uint iOffset = (uint)FieldOffsets.FirstSubTableHeader;                //Fill in the tables

                for (int i = 0; i < m_nTables; i++)
                {
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).version, (uint)iOffset);
                    iOffset += 2;
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).length, (uint)iOffset);
                    iOffset += 2;
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).coverage, (uint)iOffset);
                    iOffset += 2;
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).nPairs, (uint)iOffset);
                    iOffset += 2;
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).searchRange, (uint)iOffset);
                    iOffset += 2;
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).entrySelector, (uint)iOffset);
                    iOffset += 2;
                    newbuf.SetUshort(((SubTableFormat0)m_SubTable[i]).rangeShift, (uint)iOffset);
                    iOffset += 2;

                    // Cycle through all of the kerning pairs
                    for (int ii = 0; ii < ((SubTableFormat0)m_SubTable[i]).nPairs; ii++)
                    {
                        ((SubTableFormat0)m_SubTable[i]).GetKerningPairAndValue(ii, ref nLeft, ref nRight, ref nValue);
                        newbuf.SetUshort(nLeft, (uint)iOffset);
                        iOffset += 2;
                        newbuf.SetUshort(nRight, (uint)iOffset);
                        iOffset += 2;
                        newbuf.SetShort(nValue, (uint)iOffset);
                        iOffset += 2;
                    }
                }

                // put the buffer into a Table_vhmtx object and return it
                Table_kern kernTable = new Table_kern("kern", newbuf);

                return(kernTable);
            }
Exemple #2
0
            ArrayList m_SubTable; // SubTableFormat0[] since we only support format 0

            public kern_cache(Table_kern OwnerTable)
            {
                m_version = OwnerTable.version;
                m_nTables = 0;
                ushort nTablesTemp = OwnerTable.nTables;

                m_SubTable = new ArrayList(m_nTables);

                for (ushort i = 0; i < nTablesTemp; i++)
                {
                    SubTable SubTableTemp = OwnerTable.GetSubTable(i);

                    //NOTE: Since these subtables could be Format 2 and we don't support them we will strip them out
                    if (null != SubTableTemp && 0 == SubTableTemp.GetFormat())
                    {
                        m_SubTable.Add(SubTableTemp);
                        m_nTables++;
                    }
                }
            }
Exemple #3
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);
        }
        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;
        }
            public override OTTable GenerateTable()
            {
                uint iSizeOfTables = 0;
                ushort nLeft = 0;
                ushort nRight = 0;
                short nValue = 0;
                // Find the sizeof all of the tables
                for( ushort i = 0; i < m_nTables; i++ )
                {
                    iSizeOfTables += (uint)((SubTableFormat0)m_SubTable[i]).CalculatedLength();    
                }                                                  
                                                  
                // create a Motorola Byte Order buffer for the new table
                MBOBuffer newbuf = new MBOBuffer( (uint)FieldOffsets.FirstSubTableHeader + iSizeOfTables );

                newbuf.SetUshort( m_version,    (uint)FieldOffsets.version );
                newbuf.SetUshort( m_nTables,    (uint)FieldOffsets.nTables );

                uint iOffset = (uint)FieldOffsets.FirstSubTableHeader;                //Fill in the tables
                for( int i = 0; i < m_nTables; i++ )
                {
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).version,            (uint)iOffset );
                    iOffset += 2;
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).length,            (uint)iOffset );
                    iOffset += 2;
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).coverage,        (uint)iOffset );
                    iOffset += 2;
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).nPairs,            (uint)iOffset );
                    iOffset += 2;
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).searchRange,        (uint)iOffset );
                    iOffset += 2;
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).entrySelector,    (uint)iOffset );
                    iOffset += 2;
                    newbuf.SetUshort( ((SubTableFormat0)m_SubTable[i]).rangeShift,        (uint)iOffset );
                    iOffset += 2;

                    // Cycle through all of the kerning pairs
                    for( int ii = 0; ii < ((SubTableFormat0)m_SubTable[i]).nPairs; ii++ )
                    {                        
                        ((SubTableFormat0)m_SubTable[i]).GetKerningPairAndValue( ii, ref nLeft, ref nRight, ref nValue );
                        newbuf.SetUshort( nLeft,                (uint)iOffset );
                        iOffset += 2;
                        newbuf.SetUshort( nRight,                (uint)iOffset );
                        iOffset += 2;
                        newbuf.SetShort( nValue,                (uint)iOffset );
                        iOffset += 2;        
                    }
                }

                // put the buffer into a Table_vhmtx object and return it
                Table_kern kernTable = new Table_kern("kern", newbuf);
            
                return kernTable;
            }
            ArrayList m_SubTable; // SubTableFormat0[] since we only support format 0

            public kern_cache(Table_kern OwnerTable)
            {
                m_version = OwnerTable.version;
                m_nTables = 0;
                ushort nTablesTemp = OwnerTable.nTables;

                m_SubTable = new ArrayList( m_nTables );

                for( ushort i = 0; i < nTablesTemp; i ++ )
                {    
                    SubTable SubTableTemp = OwnerTable.GetSubTable( i );

                    //NOTE: Since these subtables could be Format 2 and we don't support them we will strip them out
                    if( null != SubTableTemp && 0 == SubTableTemp.GetFormat() )
                    {
                        m_SubTable.Add( SubTableTemp );
                        m_nTables++;
                    }
                }

            }