| 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 "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #include "../../../include/fxge/fx_freetype.h" | 8 #include "../../../include/fxge/fx_freetype.h" |
| 9 #include "ttgsubtable.h" | 9 #include "ttgsubtable.h" |
| 10 CFX_GlyphMap::CFX_GlyphMap() | 10 CFX_GlyphMap::CFX_GlyphMap() |
| 11 { | 11 { |
| 12 } | 12 } |
| 13 CFX_GlyphMap::~CFX_GlyphMap() | 13 CFX_GlyphMap::~CFX_GlyphMap() |
| 14 { | 14 { |
| 15 } | 15 } |
| 16 extern "C" { | 16 extern "C" { |
| 17 static int _CompareInt(const void* p1, const void* p2) | 17 static int _CompareInt(const void* p1, const void* p2) |
| 18 { | 18 { |
| 19 return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); | 19 return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); |
| 20 } | 20 } |
| 21 }; | 21 }; |
| 22 struct _IntPair { | 22 struct _IntPair { |
| 23 FX_INT32 key; | 23 int32_t key; |
| 24 FX_INT32 value; | 24 int32_t value; |
| 25 }; | 25 }; |
| 26 void CFX_GlyphMap::SetAt(int key, int value) | 26 void CFX_GlyphMap::SetAt(int key, int value) |
| 27 { | 27 { |
| 28 FX_DWORD count = m_Buffer.GetSize() / sizeof(_IntPair); | 28 FX_DWORD count = m_Buffer.GetSize() / sizeof(_IntPair); |
| 29 _IntPair* buf = (_IntPair*)m_Buffer.GetBuffer(); | 29 _IntPair* buf = (_IntPair*)m_Buffer.GetBuffer(); |
| 30 _IntPair pair = {key, value}; | 30 _IntPair pair = {key, value}; |
| 31 if (count == 0 || key > buf[count - 1].key) { | 31 if (count == 0 || key > buf[count - 1].key) { |
| 32 m_Buffer.AppendBlock(&pair, sizeof(_IntPair)); | 32 m_Buffer.AppendBlock(&pair, sizeof(_IntPair)); |
| 33 return; | 33 return; |
| 34 } | 34 } |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 424 } |
| 425 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) | 425 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) |
| 426 { | 426 { |
| 427 if (!pFont) { | 427 if (!pFont) { |
| 428 return NULL; | 428 return NULL; |
| 429 } | 429 } |
| 430 if (NULL == pFont->m_pGsubData) { | 430 if (NULL == pFont->m_pGsubData) { |
| 431 unsigned long length = 0; | 431 unsigned long length = 0; |
| 432 int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U
', 'B'), 0, NULL, &length); | 432 int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U
', 'B'), 0, NULL, &length); |
| 433 if (!error) { | 433 if (!error) { |
| 434 pFont->m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); | 434 pFont->m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); |
| 435 } | 435 } |
| 436 if (!pFont->m_pGsubData) { | 436 if (!pFont->m_pGsubData) { |
| 437 return NULL; | 437 return NULL; |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', '
B'), 0, pFont->m_pGsubData, NULL); | 440 int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', '
B'), 0, pFont->m_pGsubData, NULL); |
| 441 if (!error && pFont->m_pGsubData) { | 441 if (!error && pFont->m_pGsubData) { |
| 442 CFX_GSUBTable* pGsubTable = new CFX_GSUBTable; | 442 CFX_GSUBTable* pGsubTable = new CFX_GSUBTable; |
| 443 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { | 443 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { |
| 444 return pGsubTable; | 444 return pGsubTable; |
| 445 } | 445 } |
| 446 pGsubTable->Release(); | 446 pGsubTable->Release(); |
| 447 } | 447 } |
| 448 return NULL; | 448 return NULL; |
| 449 } | 449 } |
| OLD | NEW |