Chromium Code Reviews| 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/include/cpdf_font.h" | 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 } | 444 } |
| 445 | 445 |
| 446 if (!charnames.empty() && !charnames[charcode].IsEmpty()) | 446 if (!charnames.empty() && !charnames[charcode].IsEmpty()) |
| 447 return charnames[charcode].c_str(); | 447 return charnames[charcode].c_str(); |
| 448 | 448 |
| 449 const FX_CHAR* name = nullptr; | 449 const FX_CHAR* name = nullptr; |
| 450 if (iBaseEncoding) | 450 if (iBaseEncoding) |
| 451 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); | 451 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); |
| 452 return name && name[0] ? name : nullptr; | 452 return name && name[0] ? name : nullptr; |
| 453 } | 453 } |
| 454 | |
| 455 uint32_t CPDF_Font::FallbackFontFromCharcode(uint32_t charcode, | |
| 456 bool* pVertGlyph) { | |
| 457 if (m_FontFallbacks.size() < 1) { | |
|
Lei Zhang
2016/08/24 04:43:10
m_FontFallbacks.empty()
npm
2016/08/24 14:39:22
Done.
| |
| 458 m_FontFallbacks.push_back(std::unique_ptr<CFX_Font>(new CFX_Font())); | |
|
Lei Zhang
2016/08/24 04:43:10
We have our own WrapUnique() if you don't want to
npm
2016/08/24 14:39:22
Done.
| |
| 459 m_FontFallbacks[0]->LoadSubst("Arial", IsTrueTypeFont(), m_Flags, | |
| 460 m_StemV * 5, m_ItalicAngle, 0, | |
| 461 IsVertWriting()); | |
| 462 } | |
| 463 return 0; | |
|
Lei Zhang
2016/08/24 04:43:10
So always return 0?
npm
2016/08/24 14:39:22
For now, just having a single fallback font
| |
| 464 } | |
| 465 | |
| 466 int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, | |
| 467 uint32_t charcode, | |
| 468 bool* pVertGlyph) { | |
|
Lei Zhang
2016/08/24 04:43:10
not used?
npm
2016/08/24 14:39:22
The vert parameter is in GlyphFromCharcode so it m
| |
| 469 int glyph = | |
| 470 FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), charcode); | |
|
Lei Zhang
2016/08/24 04:43:10
Can |fallbackFont| go out of bound?
npm
2016/08/24 14:39:22
This should not happen if the two methods are impl
| |
| 471 if (glyph == 0 || glyph == 0xffff) | |
| 472 return -1; | |
| 473 return glyph; | |
| 474 } | |
| OLD | NEW |