Beispiel #1
0
            // Pulls out a Vertical Matric and updates vhea if necessary
            public bool removeVerticalMetric(ushort nIndex)
            {
                bool bResult = true;

                if (nIndex < m_nGlyphsInTheFont)
                {
                    // if we are removing a vertical matrix that is less the the number of long vertical
                    // metrics we need to adjust for this so we know how to write it later and fix up the vhea_table
                    if (nIndex < m_nLongVerMetrics)
                    {
                        m_nLongVerMetrics--;
                        Table_vhea.vhea_cache vheaCache = (Table_vhea.vhea_cache)m_vheaTable.GetCache();
                        vheaCache.numOfLongVerMetrics--;
                    }

                    // NOTE: Table maxp and ltsh numGlyphs isn't being dynamically updated
                    m_nGlyphsInTheFont--;

                    m_vMetric.RemoveAt(nIndex);
                    m_bDirty = true;
                }
                else
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException("Tried to remove a Vertical Matric that did not exist.");
                }

                return(bResult);
            }
Beispiel #2
0
            // Does the real work of adding
            protected bool addToVerticalMetric(ushort nIndex, ushort nAdvanceHeight, short nTopSideBearing)
            {
                bool bResult = true;

                // NOTE: This might not be OK we might want to add a glyph that is much greater the the number that is there now
                if (nIndex <= m_nGlyphsInTheFont)
                {
                    // if we are adding a vertical matrix that is less the the number of long vertical
                    // metrics we need to adjust for this so we know how to write it later and fix up the vhea_table
                    if (nIndex < m_nLongVerMetrics || (nIndex == m_nLongVerMetrics && nAdvanceHeight != 0))
                    {
                        m_nLongVerMetrics++;
                        Table_vhea.vhea_cache vheaCache = (Table_vhea.vhea_cache)m_vheaTable.GetCache();
                        vheaCache.numOfLongVerMetrics++;
                    }

                    // NOTE: Table maxp and ltsh numGlyphs isn't being dynamically updated
                    m_nGlyphsInTheFont++;

                    vMetric vm = new vMetric();

                    vm.advanceHeight  = nAdvanceHeight;
                    vm.topSideBearing = nTopSideBearing;

                    m_vMetric.Insert(nIndex, vm);
                    m_bDirty = true;
                }
                else
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException("Tried to add a Vertical Matric to a position greater than the number of Glyphs + 1.");
                }

                return(bResult);
            }