bool CFX_CTTGSUBTable::GetVerticalGlyph(TT_uint32_t glyphnum, TT_uint32_t *vglyphnum) { TT_uint32_t tag[] = { (TT_uint8_t)'v' << 24 | (TT_uint8_t)'r' << 16 | (TT_uint8_t)'t' << 8 | (TT_uint8_t)'2', (TT_uint8_t)'v' << 24 | (TT_uint8_t)'e' << 16 | (TT_uint8_t)'r' << 8 | (TT_uint8_t)'t', }; if (!m_bFeautureMapLoad) { for (int i = 0; i < ScriptList.ScriptCount; i++) { for (int j = 0; j < (ScriptList.ScriptRecord + i)->Script.LangSysCount; ++j) { for (int k = 0; k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j)->LangSys.FeatureCount; ++k) { FX_DWORD index = *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j)->LangSys.FeatureIndex + k); if (FeatureList.FeatureRecord[index].FeatureTag == tag[0] || FeatureList.FeatureRecord[index].FeatureTag == tag[1]) { FX_DWORD value; if (!m_featureMap.Lookup(index, value)) { m_featureMap.SetAt(index, index); } } } } } if (!m_featureMap.GetStartPosition()) { for (int i = 0; i < FeatureList.FeatureCount; i ++) { if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { FX_DWORD value; if (!m_featureMap.Lookup(i, value)) { m_featureMap.SetAt(i, i); } } } } m_bFeautureMapLoad = TRUE; } FX_POSITION pos = m_featureMap.GetStartPosition(); while (pos) { FX_DWORD index, value; m_featureMap.GetNextAssoc(pos, index, value); if(GetVerticalGlyphSub(glyphnum, vglyphnum, &FeatureList.FeatureRecord[value].Feature)) { return true; } } return false; }
bool CFX_CTTGSUBTable::GetVerticalGlyph(TT_uint32_t glyphnum, TT_uint32_t* vglyphnum) { TT_uint32_t tag[] = { (TT_uint8_t)'v' << 24 | (TT_uint8_t)'r' << 16 | (TT_uint8_t)'t' << 8 | (TT_uint8_t)'2', (TT_uint8_t)'v' << 24 | (TT_uint8_t)'e' << 16 | (TT_uint8_t)'r' << 8 | (TT_uint8_t)'t', }; if (!m_bFeautureMapLoad) { for (int i = 0; i < ScriptList.ScriptCount; i++) { for (int j = 0; j < (ScriptList.ScriptRecord + i)->Script.LangSysCount; ++j) { for (int k = 0; k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) ->LangSys.FeatureCount; ++k) { FX_DWORD index = *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) ->LangSys.FeatureIndex + k); if (FeatureList.FeatureRecord[index].FeatureTag == tag[0] || FeatureList.FeatureRecord[index].FeatureTag == tag[1]) { if (m_featureMap.find(index) == m_featureMap.end()) { m_featureMap[index] = index; } } } } } if (m_featureMap.empty()) { for (int i = 0; i < FeatureList.FeatureCount; i++) { if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { m_featureMap[i] = i; } } } m_bFeautureMapLoad = TRUE; } for (const auto& pair : m_featureMap) { if (GetVerticalGlyphSub(glyphnum, vglyphnum, &FeatureList.FeatureRecord[pair.second].Feature)) { return true; } } return false; }