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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ParseCoverage(&raw[offset], &rec->Coverage); | 375 ParseCoverage(&raw[offset], &rec->Coverage); |
376 rec->GlyphCount = GetUInt16(sp); | 376 rec->GlyphCount = GetUInt16(sp); |
377 if (rec->GlyphCount <= 0) { | 377 if (rec->GlyphCount <= 0) { |
378 return; | 378 return; |
379 } | 379 } |
380 rec->Substitute = new uint16_t[rec->GlyphCount]; | 380 rec->Substitute = new uint16_t[rec->GlyphCount]; |
381 for (i = 0; i < rec->GlyphCount; i++) { | 381 for (i = 0; i < rec->GlyphCount; i++) { |
382 rec->Substitute[i] = GetUInt16(sp); | 382 rec->Substitute[i] = GetUInt16(sp); |
383 } | 383 } |
384 } | 384 } |
385 FX_BOOL CFX_GSUBTable::GetVerticalGlyph(uint32_t glyphnum, | |
386 uint32_t* vglyphnum) { | |
387 return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum); | |
388 } | |
389 // static | |
390 IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) { | |
391 if (!pFont) { | |
392 return NULL; | |
393 } | |
394 if (!pFont->GetSubData()) { | |
395 unsigned long length = 0; | |
396 int error = FXFT_Load_Sfnt_Table( | |
397 pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); | |
398 if (!error) { | |
399 pFont->SetSubData(FX_Alloc(uint8_t, length)); | |
400 } | |
401 if (!pFont->GetSubData()) { | |
402 return NULL; | |
403 } | |
404 } | |
405 int error = | |
406 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, | |
407 pFont->GetSubData(), NULL); | |
408 if (!error && pFont->GetSubData()) { | |
409 std::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); | |
410 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { | |
411 return pGsubTable.release(); | |
412 } | |
413 } | |
414 return NULL; | |
415 } | |
OLD | NEW |