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 "core/fpdfapi/font/ttgsubtable.h" | 7 #include "core/fpdfapi/font/ttgsubtable.h" |
8 | 8 |
9 #include "core/fxge/fx_freetype.h" | 9 #include "core/fxge/fx_freetype.h" |
10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } else if (buf[mid].key > key) { | 40 } else if (buf[mid].key > key) { |
41 high = mid - 1; | 41 high = mid - 1; |
42 } else { | 42 } else { |
43 buf[mid].value = value; | 43 buf[mid].value = value; |
44 return; | 44 return; |
45 } | 45 } |
46 } | 46 } |
47 m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); | 47 m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); |
48 } | 48 } |
49 | 49 |
50 FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) { | 50 bool CFX_GlyphMap::Lookup(int key, int& value) { |
51 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), | 51 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), |
52 m_Buffer.GetSize() / sizeof(_IntPair), | 52 m_Buffer.GetSize() / sizeof(_IntPair), |
53 sizeof(_IntPair), _CompareInt); | 53 sizeof(_IntPair), _CompareInt); |
54 if (!pResult) { | 54 if (!pResult) { |
55 return FALSE; | 55 return false; |
56 } | 56 } |
57 value = ((uint32_t*)pResult)[1]; | 57 value = ((uint32_t*)pResult)[1]; |
58 return TRUE; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 CFX_CTTGSUBTable::CFX_CTTGSUBTable() | 61 CFX_CTTGSUBTable::CFX_CTTGSUBTable() |
62 : m_bFeautureMapLoad(FALSE), loaded(false) {} | 62 : m_bFeautureMapLoad(false), loaded(false) {} |
63 | 63 |
64 CFX_CTTGSUBTable::CFX_CTTGSUBTable(FT_Bytes gsub) | 64 CFX_CTTGSUBTable::CFX_CTTGSUBTable(FT_Bytes gsub) |
65 : m_bFeautureMapLoad(FALSE), loaded(false) { | 65 : m_bFeautureMapLoad(false), loaded(false) { |
66 LoadGSUBTable(gsub); | 66 LoadGSUBTable(gsub); |
67 } | 67 } |
68 | 68 |
69 CFX_CTTGSUBTable::~CFX_CTTGSUBTable() {} | 69 CFX_CTTGSUBTable::~CFX_CTTGSUBTable() {} |
70 | 70 |
71 bool CFX_CTTGSUBTable::IsOk() const { | 71 bool CFX_CTTGSUBTable::IsOk() const { |
72 return loaded; | 72 return loaded; |
73 } | 73 } |
74 | 74 |
75 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { | 75 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 } | 109 } |
110 if (m_featureMap.empty()) { | 110 if (m_featureMap.empty()) { |
111 for (int i = 0; i < FeatureList.FeatureCount; i++) { | 111 for (int i = 0; i < FeatureList.FeatureCount; i++) { |
112 if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || | 112 if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || |
113 FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { | 113 FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { |
114 m_featureMap[i] = i; | 114 m_featureMap[i] = i; |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 m_bFeautureMapLoad = TRUE; | 118 m_bFeautureMapLoad = true; |
119 } | 119 } |
120 for (const auto& pair : m_featureMap) { | 120 for (const auto& pair : m_featureMap) { |
121 if (GetVerticalGlyphSub(glyphnum, vglyphnum, | 121 if (GetVerticalGlyphSub(glyphnum, vglyphnum, |
122 &FeatureList.FeatureRecord[pair.second].Feature)) { | 122 &FeatureList.FeatureRecord[pair.second].Feature)) { |
123 return true; | 123 return true; |
124 } | 124 } |
125 } | 125 } |
126 return false; | 126 return false; |
127 } | 127 } |
128 | 128 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 CFX_CTTGSUBTable::TFeatureList::~TFeatureList() {} | 493 CFX_CTTGSUBTable::TFeatureList::~TFeatureList() {} |
494 | 494 |
495 CFX_CTTGSUBTable::TLookupList::TLookupList() : LookupCount(0) {} | 495 CFX_CTTGSUBTable::TLookupList::TLookupList() : LookupCount(0) {} |
496 | 496 |
497 CFX_CTTGSUBTable::TLookupList::~TLookupList() {} | 497 CFX_CTTGSUBTable::TLookupList::~TLookupList() {} |
498 | 498 |
499 CFX_CTTGSUBTable::TLangSys::TLangSys() | 499 CFX_CTTGSUBTable::TLangSys::TLangSys() |
500 : LookupOrder(0), ReqFeatureIndex(0), FeatureCount(0) {} | 500 : LookupOrder(0), ReqFeatureIndex(0), FeatureCount(0) {} |
501 | 501 |
502 CFX_CTTGSUBTable::TLangSys::~TLangSys() {} | 502 CFX_CTTGSUBTable::TLangSys::~TLangSys() {} |
OLD | NEW |