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 <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 const uint8_t* pTransform = GetCIDTransform(CID); | 484 const uint8_t* pTransform = GetCIDTransform(CID); |
485 if (pTransform && !bVert) { | 485 if (pTransform && !bVert) { |
486 CFX_Matrix matrix(CIDTransformToFloat(pTransform[0]), | 486 CFX_Matrix matrix(CIDTransformToFloat(pTransform[0]), |
487 CIDTransformToFloat(pTransform[1]), | 487 CIDTransformToFloat(pTransform[1]), |
488 CIDTransformToFloat(pTransform[2]), | 488 CIDTransformToFloat(pTransform[2]), |
489 CIDTransformToFloat(pTransform[3]), | 489 CIDTransformToFloat(pTransform[3]), |
490 CIDTransformToFloat(pTransform[4]) * 1000, | 490 CIDTransformToFloat(pTransform[4]) * 1000, |
491 CIDTransformToFloat(pTransform[5]) * 1000); | 491 CIDTransformToFloat(pTransform[5]) * 1000); |
492 CFX_FloatRect rect_f(rect); | 492 CFX_FloatRect rect_f(rect); |
493 rect_f.Transform(&matrix); | 493 rect_f.Transform(&matrix); |
494 rect = rect_f.GetOutterRect(); | 494 rect = rect_f.GetOuterRect(); |
495 } | 495 } |
496 } | 496 } |
497 if (charcode < 256) | 497 if (charcode < 256) |
498 m_CharBBox[charcode] = rect.ToSmallRect(); | 498 m_CharBBox[charcode] = rect.ToSmallRect(); |
499 | 499 |
500 return rect; | 500 return rect; |
501 } | 501 } |
502 int CPDF_CIDFont::GetCharWidthF(uint32_t charcode, int level) { | 502 int CPDF_CIDFont::GetCharWidthF(uint32_t charcode, int level) { |
503 if (charcode < 0x80 && m_bAnsiWidthsFixed) | 503 if (charcode < 0x80 && m_bAnsiWidthsFixed) |
504 return charcode >= 32 && charcode < 127 ? 500 : 0; | 504 return charcode >= 32 && charcode < 127 ? 500 : 0; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { | 833 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { |
834 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 834 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
835 return nullptr; | 835 return nullptr; |
836 | 836 |
837 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs); | 837 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs); |
838 const auto* pTransform = std::lower_bound( | 838 const auto* pTransform = std::lower_bound( |
839 g_Japan1_VertCIDs, pEnd, CID, | 839 g_Japan1_VertCIDs, pEnd, CID, |
840 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; }); | 840 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; }); |
841 return pTransform < pEnd && CID == pTransform->cid ? &pTransform->a : nullptr; | 841 return pTransform < pEnd && CID == pTransform->cid ? &pTransform->a : nullptr; |
842 } | 842 } |
OLD | NEW |