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/fpdfapi/fpdf_module.h" | 7 #include "../../../include/fpdfapi/fpdf_module.h" |
8 #include "../../../include/fpdfapi/fpdf_page.h" | 8 #include "../../../include/fpdfapi/fpdf_page.h" |
9 #include "../../../include/fpdfapi/fpdf_resource.h" | 9 #include "../../../include/fpdfapi/fpdf_resource.h" |
10 #include "../../../include/fxge/fx_freetype.h" | 10 #include "../../../include/fxge/fx_freetype.h" |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 } | 1660 } |
1661 void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, | 1661 void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, |
1662 CFX_DWordArray& result, | 1662 CFX_DWordArray& result, |
1663 int nElements) { | 1663 int nElements) { |
1664 int width_status = 0; | 1664 int width_status = 0; |
1665 int iCurElement = 0; | 1665 int iCurElement = 0; |
1666 int first_code = 0, last_code; | 1666 int first_code = 0, last_code; |
1667 FX_DWORD count = pArray->GetCount(); | 1667 FX_DWORD count = pArray->GetCount(); |
1668 for (FX_DWORD i = 0; i < count; i++) { | 1668 for (FX_DWORD i = 0; i < count; i++) { |
1669 CPDF_Object* pObj = pArray->GetElementValue(i); | 1669 CPDF_Object* pObj = pArray->GetElementValue(i); |
1670 if (pObj == NULL) { | 1670 if (!pObj) |
1671 continue; | 1671 continue; |
1672 } | 1672 |
1673 if (pObj->GetType() == PDFOBJ_ARRAY) { | 1673 if (CPDF_Array* pArray = pObj->AsArray()) { |
1674 if (width_status != 1) { | 1674 if (width_status != 1) |
1675 return; | 1675 return; |
1676 } | 1676 |
1677 CPDF_Array* pArray = (CPDF_Array*)pObj; | |
1678 FX_DWORD count = pArray->GetCount(); | 1677 FX_DWORD count = pArray->GetCount(); |
1679 for (FX_DWORD j = 0; j < count; j += nElements) { | 1678 for (FX_DWORD j = 0; j < count; j += nElements) { |
1680 result.Add(first_code); | 1679 result.Add(first_code); |
1681 result.Add(first_code); | 1680 result.Add(first_code); |
1682 for (int k = 0; k < nElements; k++) { | 1681 for (int k = 0; k < nElements; k++) { |
1683 result.Add(pArray->GetInteger(j + k)); | 1682 result.Add(pArray->GetInteger(j + k)); |
1684 } | 1683 } |
1685 first_code++; | 1684 first_code++; |
1686 } | 1685 } |
1687 width_status = 0; | 1686 width_status = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 | 1745 |
1747 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { | 1746 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { |
1748 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 1747 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
1749 return nullptr; | 1748 return nullptr; |
1750 | 1749 |
1751 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 1750 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
1752 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 1751 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
1753 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 1752 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
1754 return found ? &found->a : nullptr; | 1753 return found ? &found->a : nullptr; |
1755 } | 1754 } |
OLD | NEW |