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