| 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 "ttgsubtable.h" | 7 #include "ttgsubtable.h" |
| 8 | 8 |
| 9 #include "core/include/fxge/fx_freetype.h" | 9 #include "core/include/fxge/fx_freetype.h" |
| 10 #include "core/include/fxge/fx_ge.h" | 10 #include "core/include/fxge/fx_ge.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 buf[mid].value = value; | 40 buf[mid].value = value; |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); | 44 m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); |
| 45 } | 45 } |
| 46 FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) { | 46 FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) { |
| 47 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), | 47 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), |
| 48 m_Buffer.GetSize() / sizeof(_IntPair), | 48 m_Buffer.GetSize() / sizeof(_IntPair), |
| 49 sizeof(_IntPair), _CompareInt); | 49 sizeof(_IntPair), _CompareInt); |
| 50 if (pResult == NULL) { | 50 if (!pResult) { |
| 51 return FALSE; | 51 return FALSE; |
| 52 } | 52 } |
| 53 value = ((FX_DWORD*)pResult)[1]; | 53 value = ((FX_DWORD*)pResult)[1]; |
| 54 return TRUE; | 54 return TRUE; |
| 55 } | 55 } |
| 56 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { | 56 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { |
| 57 header.Version = gsub[0] << 24 | gsub[1] << 16 | gsub[2] << 8 | gsub[3]; | 57 header.Version = gsub[0] << 24 | gsub[1] << 16 | gsub[2] << 8 | gsub[3]; |
| 58 if (header.Version != 0x00010000) { | 58 if (header.Version != 0x00010000) { |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 break; | 152 break; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 return false; | 156 return false; |
| 157 } | 157 } |
| 158 int CFX_CTTGSUBTable::GetCoverageIndex(struct TCoverageFormatBase* Coverage, | 158 int CFX_CTTGSUBTable::GetCoverageIndex(struct TCoverageFormatBase* Coverage, |
| 159 uint32_t g) { | 159 uint32_t g) { |
| 160 int i = 0; | 160 int i = 0; |
| 161 if (Coverage == NULL) { | 161 if (!Coverage) { |
| 162 return -1; | 162 return -1; |
| 163 } | 163 } |
| 164 switch (Coverage->CoverageFormat) { | 164 switch (Coverage->CoverageFormat) { |
| 165 case 1: { | 165 case 1: { |
| 166 TCoverageFormat1* c1 = (TCoverageFormat1*)Coverage; | 166 TCoverageFormat1* c1 = (TCoverageFormat1*)Coverage; |
| 167 for (i = 0; i < c1->GlyphCount; i++) { | 167 for (i = 0; i < c1->GlyphCount; i++) { |
| 168 if ((uint32_t)c1->GlyphArray[i] == g) { | 168 if ((uint32_t)c1->GlyphArray[i] == g) { |
| 169 return i; | 169 return i; |
| 170 } | 170 } |
| 171 } | 171 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, | 404 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, |
| 405 pFont->GetSubData(), NULL); | 405 pFont->GetSubData(), NULL); |
| 406 if (!error && pFont->GetSubData()) { | 406 if (!error && pFont->GetSubData()) { |
| 407 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); | 407 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); |
| 408 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { | 408 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { |
| 409 return pGsubTable.release(); | 409 return pGsubTable.release(); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 return NULL; | 412 return NULL; |
| 413 } | 413 } |
| OLD | NEW |