public uint FastMapUnicode32ToGlyphID(uint c) { // this routine caches the windows 3,10 cmap for better performance // but might use tons of heap uint glyphID = 0xffffffff; if (m_arrUnicodeToGlyph_3_10 == null) { Table_cmap cmapTable = (Table_cmap)GetTable("cmap"); if (cmapTable != null) { Table_cmap.Format12 subtable = (Table_cmap.Format12)cmapTable.GetSubtable(3, 10); // Apple Color Emoji does not have a 3.10 charmap if (subtable == null) { return(glyphID); } Table_cmap.Format12.Group g = subtable.GetGroup(subtable.nGroups - 1); uint nArraySize = g.endCharCode + 1; m_arrUnicodeToGlyph_3_10 = new uint[nArraySize]; for (uint i = 0; i < nArraySize; i++) { m_arrUnicodeToGlyph_3_10[i] = 0; } for (uint nGroup = 0; nGroup < subtable.nGroups; nGroup++) { g = subtable.GetGroup(nGroup); for (uint i = 0; i <= g.endCharCode - g.startCharCode; i++) { m_arrUnicodeToGlyph_3_10[g.startCharCode + i] = g.startGlyphID + i; } } } } Debug.Assert(m_arrUnicodeToGlyph_3_10 != null); if (m_arrUnicodeToGlyph_3_10 != null) { if (c >= m_arrUnicodeToGlyph_3_10.Length) { return(0); } glyphID = m_arrUnicodeToGlyph_3_10[c]; } return(glyphID); }
public bool HaveNonBMPChars() { Table_cmap cmapTable = (Table_cmap)GetTable("cmap"); if (cmapTable != null) { Table_cmap.Format12 subtable = (Table_cmap.Format12)cmapTable.GetSubtable(3, 10); if (subtable != null) { return(true); } } return(false); }