| 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/fpdf_font/ttgsubtable.h" | 7 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), | 54 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), |
| 55 m_Buffer.GetSize() / sizeof(_IntPair), | 55 m_Buffer.GetSize() / sizeof(_IntPair), |
| 56 sizeof(_IntPair), _CompareInt); | 56 sizeof(_IntPair), _CompareInt); |
| 57 if (!pResult) { | 57 if (!pResult) { |
| 58 return FALSE; | 58 return FALSE; |
| 59 } | 59 } |
| 60 value = ((uint32_t*)pResult)[1]; | 60 value = ((uint32_t*)pResult)[1]; |
| 61 return TRUE; | 61 return TRUE; |
| 62 } | 62 } |
| 63 | 63 |
| 64 CFX_CTTGSUBTable::CFX_CTTGSUBTable(void) | 64 CFX_CTTGSUBTable::CFX_CTTGSUBTable() |
| 65 : m_bFeautureMapLoad(FALSE), loaded(false) {} | 65 : m_bFeautureMapLoad(FALSE), loaded(false) {} |
| 66 | 66 |
| 67 CFX_CTTGSUBTable::CFX_CTTGSUBTable(FT_Bytes gsub) | 67 CFX_CTTGSUBTable::CFX_CTTGSUBTable(FT_Bytes gsub) |
| 68 : m_bFeautureMapLoad(FALSE), loaded(false) { | 68 : m_bFeautureMapLoad(FALSE), loaded(false) { |
| 69 LoadGSUBTable(gsub); | 69 LoadGSUBTable(gsub); |
| 70 } | 70 } |
| 71 | 71 |
| 72 CFX_CTTGSUBTable::~CFX_CTTGSUBTable() {} | 72 CFX_CTTGSUBTable::~CFX_CTTGSUBTable() {} |
| 73 | 73 |
| 74 bool CFX_CTTGSUBTable::IsOk(void) const { | 74 bool CFX_CTTGSUBTable::IsOk() const { |
| 75 return loaded; | 75 return loaded; |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { | 78 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { |
| 79 header.Version = gsub[0] << 24 | gsub[1] << 16 | gsub[2] << 8 | gsub[3]; | 79 header.Version = gsub[0] << 24 | gsub[1] << 16 | gsub[2] << 8 | gsub[3]; |
| 80 if (header.Version != 0x00010000) { | 80 if (header.Version != 0x00010000) { |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 header.ScriptList = gsub[4] << 8 | gsub[5]; | 83 header.ScriptList = gsub[4] << 8 | gsub[5]; |
| 84 header.FeatureList = gsub[6] << 8 | gsub[7]; | 84 header.FeatureList = gsub[6] << 8 | gsub[7]; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 CFX_CTTGSUBTable::TLookup::TLookup() | 512 CFX_CTTGSUBTable::TLookup::TLookup() |
| 513 : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(nullptr) {} | 513 : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(nullptr) {} |
| 514 | 514 |
| 515 CFX_CTTGSUBTable::TLookup::~TLookup() { | 515 CFX_CTTGSUBTable::TLookup::~TLookup() { |
| 516 if (SubTable) { | 516 if (SubTable) { |
| 517 for (int i = 0; i < SubTableCount; ++i) | 517 for (int i = 0; i < SubTableCount; ++i) |
| 518 delete SubTable[i]; | 518 delete SubTable[i]; |
| 519 delete[] SubTable; | 519 delete[] SubTable; |
| 520 } | 520 } |
| 521 } | 521 } |
| OLD | NEW |