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 "font_int.h" | 7 #include "font_int.h" |
8 | 8 |
9 #include "../fpdf_cmaps/cmap_int.h" | 9 #include "../fpdf_cmaps/cmap_int.h" |
10 #include "core/include/fpdfapi/fpdf_module.h" | 10 #include "core/include/fpdfapi/fpdf_module.h" |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 if (pVertGlyph) { | 1438 if (pVertGlyph) { |
1439 *pVertGlyph = FALSE; | 1439 *pVertGlyph = FALSE; |
1440 } | 1440 } |
1441 FXFT_Face face = m_Font.GetFace(); | 1441 FXFT_Face face = m_Font.GetFace(); |
1442 int index = FXFT_Get_Char_Index(face, unicode); | 1442 int index = FXFT_Get_Char_Index(face, unicode); |
1443 if (unicode == 0x2502) { | 1443 if (unicode == 0x2502) { |
1444 return index; | 1444 return index; |
1445 } | 1445 } |
1446 if (index && IsVertWriting()) { | 1446 if (index && IsVertWriting()) { |
1447 if (m_pTTGSUBTable) { | 1447 if (m_pTTGSUBTable) { |
1448 TT_uint32_t vindex = 0; | 1448 uint32_t vindex = 0; |
1449 m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); | 1449 m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); |
1450 if (vindex) { | 1450 if (vindex) { |
1451 index = vindex; | 1451 index = vindex; |
1452 if (pVertGlyph) { | 1452 if (pVertGlyph) { |
1453 *pVertGlyph = TRUE; | 1453 *pVertGlyph = TRUE; |
1454 } | 1454 } |
1455 } | 1455 } |
1456 return index; | 1456 return index; |
1457 } | 1457 } |
1458 if (!m_Font.GetSubData()) { | 1458 if (!m_Font.GetSubData()) { |
1459 unsigned long length = 0; | 1459 unsigned long length = 0; |
1460 int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, | 1460 int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, |
1461 NULL, &length); | 1461 NULL, &length); |
1462 if (!error) { | 1462 if (!error) { |
1463 m_Font.SetSubData(FX_Alloc(uint8_t, length)); | 1463 m_Font.SetSubData(FX_Alloc(uint8_t, length)); |
1464 } | 1464 } |
1465 } | 1465 } |
1466 int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, | 1466 int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, |
1467 m_Font.GetSubData(), NULL); | 1467 m_Font.GetSubData(), NULL); |
1468 if (!error && m_Font.GetSubData()) { | 1468 if (!error && m_Font.GetSubData()) { |
1469 m_pTTGSUBTable = new CFX_CTTGSUBTable; | 1469 m_pTTGSUBTable = new CFX_CTTGSUBTable; |
1470 m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.GetSubData()); | 1470 m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.GetSubData()); |
1471 TT_uint32_t vindex = 0; | 1471 uint32_t vindex = 0; |
1472 m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); | 1472 m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); |
1473 if (vindex) { | 1473 if (vindex) { |
1474 index = vindex; | 1474 index = vindex; |
1475 if (pVertGlyph) { | 1475 if (pVertGlyph) { |
1476 *pVertGlyph = TRUE; | 1476 *pVertGlyph = TRUE; |
1477 } | 1477 } |
1478 } | 1478 } |
1479 } | 1479 } |
1480 return index; | 1480 return index; |
1481 } | 1481 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 | 1746 |
1747 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { | 1747 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { |
1748 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 1748 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
1749 return nullptr; | 1749 return nullptr; |
1750 | 1750 |
1751 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 1751 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
1752 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 1752 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
1753 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 1753 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
1754 return found ? &found->a : nullptr; | 1754 return found ? &found->a : nullptr; |
1755 } | 1755 } |
OLD | NEW |