OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
9 #include "../../../include/fxge/fx_freetype.h" | 9 #include "../../../include/fxge/fx_freetype.h" |
10 #include "ttgsubtable.h" | 10 #include "ttgsubtable.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 for (int k = 0; | 78 for (int k = 0; |
79 k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) | 79 k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) |
80 ->LangSys.FeatureCount; | 80 ->LangSys.FeatureCount; |
81 ++k) { | 81 ++k) { |
82 FX_DWORD index = | 82 FX_DWORD index = |
83 *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) | 83 *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) |
84 ->LangSys.FeatureIndex + | 84 ->LangSys.FeatureIndex + |
85 k); | 85 k); |
86 if (FeatureList.FeatureRecord[index].FeatureTag == tag[0] || | 86 if (FeatureList.FeatureRecord[index].FeatureTag == tag[0] || |
87 FeatureList.FeatureRecord[index].FeatureTag == tag[1]) { | 87 FeatureList.FeatureRecord[index].FeatureTag == tag[1]) { |
88 FX_DWORD value; | 88 if (m_featureMap.find(index) == m_featureMap.end()) { |
89 if (!m_featureMap.Lookup(index, value)) { | 89 m_featureMap[index] = index; |
90 m_featureMap.SetAt(index, index); | |
91 } | 90 } |
92 } | 91 } |
93 } | 92 } |
94 } | 93 } |
95 } | 94 } |
96 if (!m_featureMap.GetStartPosition()) { | 95 if (m_featureMap.empty()) { |
97 for (int i = 0; i < FeatureList.FeatureCount; i++) { | 96 for (int i = 0; i < FeatureList.FeatureCount; i++) { |
98 if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || | 97 if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || |
99 FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { | 98 FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { |
100 FX_DWORD value; | 99 m_featureMap[i] = i; |
101 if (!m_featureMap.Lookup(i, value)) { | |
102 m_featureMap.SetAt(i, i); | |
103 } | |
104 } | 100 } |
105 } | 101 } |
106 } | 102 } |
107 m_bFeautureMapLoad = TRUE; | 103 m_bFeautureMapLoad = TRUE; |
108 } | 104 } |
109 FX_POSITION pos = m_featureMap.GetStartPosition(); | 105 for (const auto& pair : m_featureMap) { |
110 while (pos) { | |
111 FX_DWORD index, value; | |
112 m_featureMap.GetNextAssoc(pos, index, value); | |
113 if (GetVerticalGlyphSub(glyphnum, vglyphnum, | 106 if (GetVerticalGlyphSub(glyphnum, vglyphnum, |
114 &FeatureList.FeatureRecord[value].Feature)) { | 107 &FeatureList.FeatureRecord[pair.second].Feature)) { |
115 return true; | 108 return true; |
116 } | 109 } |
117 } | 110 } |
118 return false; | 111 return false; |
119 } | 112 } |
120 bool CFX_CTTGSUBTable::GetVerticalGlyphSub(TT_uint32_t glyphnum, | 113 bool CFX_CTTGSUBTable::GetVerticalGlyphSub(TT_uint32_t glyphnum, |
121 TT_uint32_t* vglyphnum, | 114 TT_uint32_t* vglyphnum, |
122 struct TFeature* Feature) { | 115 struct TFeature* Feature) { |
123 for (int i = 0; i < Feature->LookupCount; i++) { | 116 for (int i = 0; i < Feature->LookupCount; i++) { |
124 int index = Feature->LookupListIndex[i]; | 117 int index = Feature->LookupListIndex[i]; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, | 403 FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, |
411 pFont->m_pGsubData, NULL); | 404 pFont->m_pGsubData, NULL); |
412 if (!error && pFont->m_pGsubData) { | 405 if (!error && pFont->m_pGsubData) { |
413 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); | 406 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); |
414 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { | 407 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { |
415 return pGsubTable.release(); | 408 return pGsubTable.release(); |
416 } | 409 } |
417 } | 410 } |
418 return NULL; | 411 return NULL; |
419 } | 412 } |
OLD | NEW |