Пример #1
0
        public uint GetNumLeftSideBearingEntries(OTFont fontOwner)
        {
            uint nhm       = GetNumberOfHMetrics(fontOwner);
            uint numGlyphs = fontOwner.GetMaxpNumGlyphs();

            return(numGlyphs - nhm);
        }
Пример #2
0
        public header GetGlyphHeader(uint iGlyph, OTFont fontOwner)
        {
            if (iGlyph >= fontOwner.GetMaxpNumGlyphs())
            {
                throw new ArgumentOutOfRangeException("iGlyph");
            }

            header h = null;

            Table_loca locaTable = (Table_loca)fontOwner.GetTable("loca");

            if (locaTable != null)
            {
                int offsGlyph, length;
                if (locaTable.GetEntryGlyf((int)iGlyph,
                                           out offsGlyph, out length, fontOwner))
                {
                    if (length != 0)
                    {
                        h = new header((uint)offsGlyph, m_bufTable);
                    }
                }
            }

            return(h);
        }
Пример #3
0
 public uint GetGlyphInfoOffset(uint iGlyph, OTFont fontOwner)
 {
     if (iGlyph >= fontOwner.GetMaxpNumGlyphs())
     {
         throw new ArgumentOutOfRangeException("iGlyph");
     }
     return(m_bufTable.GetUint((uint)FieldOffsets.offsets + iGlyph * 4));
 }
Пример #4
0
        /************************
         * accessors
         */

        public vMetric GetVMetric(uint i, OTFont fontOwner)
        {
            vMetric vm = new vMetric();
            m_nLongVerMetrics = (ushort)GetNumOfLongVerMetrics(fontOwner); 
            m_nGlyphsInTheFont = fontOwner.GetMaxpNumGlyphs();
            
            if( i >= m_nGlyphsInTheFont )
            {
                throw new ArgumentOutOfRangeException();
            }

            vm = GetVMetric( i );            

            return vm;
        }
Пример #5
0
        /************************
         * accessors
         */

        public vMetric GetVMetric(uint i, OTFont fontOwner)
        {
            vMetric vm = new vMetric();

            m_nLongVerMetrics  = (ushort)GetNumOfLongVerMetrics(fontOwner);
            m_nGlyphsInTheFont = fontOwner.GetMaxpNumGlyphs();

            if (i >= m_nGlyphsInTheFont)
            {
                throw new ArgumentOutOfRangeException();
            }

            vm = GetVMetric(i);

            return(vm);
        }
Пример #6
0
            // constructor

            public glyf_cache(Table_glyf OwnerTable, OTFont OwnerFont)
            {
                m_arrGlyphs = new ArrayList();


                // get each glyph from the glyf table

                for (uint iGlyph = 0; iGlyph < OwnerFont.GetMaxpNumGlyphs(); iGlyph++)
                {
                    header h = OwnerTable.GetGlyphHeader(iGlyph, OwnerFont);
                    if (h == null)
                    {
                        m_arrGlyphs.Add(null);
                    }
                    else
                    {
                        glyph_base gb = GetGlyphLogicalData(h);
                        m_arrGlyphs.Add(gb);
                    }
                }
            }
Пример #7
0
        public longHorMetric GetOrMakeHMetric(uint i, OTFont fontOwner)
        {
            longHorMetric hm = null;
            m_nGlyphsInTheFont = fontOwner.GetMaxpNumGlyphs();            
            m_nNumberOfHMetrics = GetNumberOfHMetrics(fontOwner);
            uint nlsb = GetNumLeftSideBearingEntries(fontOwner);
            uint CalcTableLength = (uint)m_nNumberOfHMetrics*4 + nlsb*2;

            if( i >= m_nGlyphsInTheFont )
            {
                throw new ArgumentOutOfRangeException();
            }            

            // only try to parse out the data if the table length is correct
            if (CalcTableLength == GetLength())
            {
                hm = GetOrMakeHMetric( i );                
            }

            return hm;
        }
Пример #8
0
        public longHorMetric GetOrMakeHMetric(uint i, OTFont fontOwner)
        {
            longHorMetric hm = null;

            m_nGlyphsInTheFont  = fontOwner.GetMaxpNumGlyphs();
            m_nNumberOfHMetrics = GetNumberOfHMetrics(fontOwner);
            uint nlsb            = GetNumLeftSideBearingEntries(fontOwner);
            uint CalcTableLength = (uint)m_nNumberOfHMetrics * 4 + nlsb * 2;

            if (i >= m_nGlyphsInTheFont)
            {
                throw new ArgumentOutOfRangeException();
            }

            // only try to parse out the data if the table length is correct
            if (CalcTableLength == GetLength())
            {
                hm = GetOrMakeHMetric(i);
            }

            return(hm);
        }
Пример #9
0
            // constructor

            public glyf_cache(Table_glyf OwnerTable, OTFont OwnerFont)
            {
                m_arrGlyphs = new ArrayList();


                // get each glyph from the glyf table

                for (uint iGlyph=0; iGlyph<OwnerFont.GetMaxpNumGlyphs(); iGlyph++)
                {
                    header h = OwnerTable.GetGlyphHeader(iGlyph, OwnerFont);
                    if (h == null)
                    {
                        m_arrGlyphs.Add(null);
                    }
                    else
                    {
                        glyph_base gb = GetGlyphLogicalData(h);
                        m_arrGlyphs.Add(gb);
                    }
                }

            }
Пример #10
0
        public header GetGlyphHeader(uint iGlyph, OTFont fontOwner)
        {
            if (iGlyph >= fontOwner.GetMaxpNumGlyphs())
            {
                throw new ArgumentOutOfRangeException("iGlyph");
            }

            header h = null;

            Table_loca locaTable = (Table_loca)fontOwner.GetTable("loca");
            if (locaTable != null)
            {
                int offsGlyph, length;
                if (locaTable.GetEntryGlyf((int)iGlyph, 
                    out offsGlyph, out length, fontOwner))
                {
                    if (length!=0)
                    {
                        h = new header((uint)offsGlyph, m_bufTable);
                    }
                }
            }

            return h;
        }
Пример #11
0
 public uint GetNumLeftSideBearingEntries(OTFont fontOwner)
 {
     uint nhm = GetNumberOfHMetrics(fontOwner);
     uint numGlyphs = fontOwner.GetMaxpNumGlyphs();
     return numGlyphs - nhm;
 }
Пример #12
0
 public uint GetGlyphInfoOffset(uint iGlyph, OTFont fontOwner)
 {
     if (iGlyph >= fontOwner.GetMaxpNumGlyphs())
     {
         throw new ArgumentOutOfRangeException("iGlyph");
     }
     return m_bufTable.GetUint((uint)FieldOffsets.offsets + iGlyph*4);
 }