| 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_simplefont.h" | 7 #include "core/fpdfapi/fpdf_font/cpdf_simplefont.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_font/font_int.h" | 9 #include "core/fpdfapi/fpdf_font/font_int.h" |
| 10 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" | 10 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 m_CharWidth[charcode] = TT_Width; | 71 m_CharWidth[charcode] = TT_Width; |
| 72 } else if (TT_Width && !IsEmbedded()) { | 72 } else if (TT_Width && !IsEmbedded()) { |
| 73 m_CharBBox[charcode].right = | 73 m_CharBBox[charcode].right = |
| 74 m_CharBBox[charcode].right * m_CharWidth[charcode] / TT_Width; | 74 m_CharBBox[charcode].right * m_CharWidth[charcode] / TT_Width; |
| 75 m_CharBBox[charcode].left = | 75 m_CharBBox[charcode].left = |
| 76 m_CharBBox[charcode].left * m_CharWidth[charcode] / TT_Width; | 76 m_CharBBox[charcode].left * m_CharWidth[charcode] / TT_Width; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 int CPDF_SimpleFont::GetCharWidthF(uint32_t charcode, int level) { | 81 int CPDF_SimpleFont::GetCharWidthF(uint32_t charcode) { |
| 82 if (charcode > 0xff) | 82 if (charcode > 0xff) |
| 83 charcode = 0; | 83 charcode = 0; |
| 84 | 84 |
| 85 if (m_CharWidth[charcode] == 0xffff) { | 85 if (m_CharWidth[charcode] == 0xffff) { |
| 86 LoadCharMetrics(charcode); | 86 LoadCharMetrics(charcode); |
| 87 if (m_CharWidth[charcode] == 0xffff) { | 87 if (m_CharWidth[charcode] == 0xffff) { |
| 88 m_CharWidth[charcode] = 0; | 88 m_CharWidth[charcode] = 0; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 return m_CharWidth[charcode]; | 91 return m_CharWidth[charcode]; |
| 92 } | 92 } |
| 93 | 93 |
| 94 FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode, int level) { | 94 FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode) { |
| 95 if (charcode > 0xff) | 95 if (charcode > 0xff) |
| 96 charcode = 0; | 96 charcode = 0; |
| 97 | 97 |
| 98 if (m_CharBBox[charcode].left == -1) | 98 if (m_CharBBox[charcode].left == -1) |
| 99 LoadCharMetrics(charcode); | 99 LoadCharMetrics(charcode); |
| 100 | 100 |
| 101 return m_CharBBox[charcode]; | 101 return m_CharBBox[charcode]; |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool CPDF_SimpleFont::LoadCommon() { | 104 bool CPDF_SimpleFont::LoadCommon() { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return CFX_WideString(); | 207 return CFX_WideString(); |
| 208 return ret; | 208 return ret; |
| 209 } | 209 } |
| 210 | 210 |
| 211 uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { | 211 uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { |
| 212 uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode); | 212 uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode); |
| 213 if (ret) | 213 if (ret) |
| 214 return ret; | 214 return ret; |
| 215 return m_Encoding.CharCodeFromUnicode(unicode); | 215 return m_Encoding.CharCodeFromUnicode(unicode); |
| 216 } | 216 } |
| OLD | NEW |