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, | |
dsinclair
2016/08/23 19:41:18
This only ever returns 1, can the return value jus
npm
2016/08/23 20:36:57
The intention is that the return value may be diff
| |
456 bool* pVertGlyph) { | |
457 if (m_FontPlusFallbacks.size() < 2) { | |
458 m_FontPlusFallbacks.push_back(new CFX_Font()); | |
dsinclair
2016/08/23 19:41:18
This font is going to end up leaking. The other fo
npm
2016/08/23 20:36:57
Ok, a vector of unique pointers using only the fal
| |
459 m_FontPlusFallbacks[1]->LoadSubst("Arial", IsTrueTypeFont(), m_Flags, | |
460 m_StemV * 5, m_ItalicAngle, 0, | |
461 IsVertWriting()); | |
462 } | |
463 return 1; | |
464 } | |
465 | |
466 int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, | |
467 uint32_t charcode, | |
468 bool* pVertGlyph) { | |
469 int glyph = FXFT_Get_Char_Index(m_FontPlusFallbacks[fallbackFont]->GetFace(), | |
470 charcode); | |
471 if (glyph == 0 || glyph == 0xffff) | |
472 return -1; | |
473 return glyph; | |
474 } | |
OLD | NEW |