OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdf_cidfont.h" | 7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" | 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" |
10 #include "core/fpdfapi/fpdf_font/font_int.h" | 10 #include "core/fpdfapi/fpdf_font/font_int.h" |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 m_Font.LoadSubst(m_BaseFont, !m_bType1, m_Flags, m_StemV * 5, m_ItalicAngle, | 810 m_Font.LoadSubst(m_BaseFont, !m_bType1, m_Flags, m_StemV * 5, m_ItalicAngle, |
811 g_CharsetCPs[m_Charset], IsVertWriting()); | 811 g_CharsetCPs[m_Charset], IsVertWriting()); |
812 } | 812 } |
813 void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, | 813 void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, |
814 CFX_ArrayTemplate<uint32_t>& result, | 814 CFX_ArrayTemplate<uint32_t>& result, |
815 int nElements) { | 815 int nElements) { |
816 int width_status = 0; | 816 int width_status = 0; |
817 int iCurElement = 0; | 817 int iCurElement = 0; |
818 int first_code = 0; | 818 int first_code = 0; |
819 int last_code = 0; | 819 int last_code = 0; |
820 uint32_t count = pArray->GetCount(); | 820 for (size_t i = 0; i < pArray->GetCount(); i++) { |
821 for (uint32_t i = 0; i < count; i++) { | |
822 CPDF_Object* pObj = pArray->GetDirectObjectAt(i); | 821 CPDF_Object* pObj = pArray->GetDirectObjectAt(i); |
823 if (!pObj) | 822 if (!pObj) |
824 continue; | 823 continue; |
825 | 824 |
826 if (CPDF_Array* pArray = pObj->AsArray()) { | 825 if (CPDF_Array* pArray = pObj->AsArray()) { |
827 if (width_status != 1) | 826 if (width_status != 1) |
828 return; | 827 return; |
829 | 828 |
830 uint32_t count = pArray->GetCount(); | 829 for (size_t j = 0; j < pArray->GetCount(); j += nElements) { |
831 for (uint32_t j = 0; j < count; j += nElements) { | |
832 result.Add(first_code); | 830 result.Add(first_code); |
833 result.Add(first_code); | 831 result.Add(first_code); |
834 for (int k = 0; k < nElements; k++) { | 832 for (int k = 0; k < nElements; k++) { |
835 result.Add(pArray->GetIntegerAt(j + k)); | 833 result.Add(pArray->GetIntegerAt(j + k)); |
836 } | 834 } |
837 first_code++; | 835 first_code++; |
838 } | 836 } |
839 width_status = 0; | 837 width_status = 0; |
840 } else { | 838 } else { |
841 if (width_status == 0) { | 839 if (width_status == 0) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 896 |
899 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { | 897 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { |
900 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 898 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
901 return nullptr; | 899 return nullptr; |
902 | 900 |
903 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 901 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
904 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 902 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
905 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 903 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
906 return found ? &found->a : nullptr; | 904 return found ? &found->a : nullptr; |
907 } | 905 } |
OLD | NEW |