Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: core/fpdfapi/fpdf_font/cpdf_font.cpp

Issue 2276653002: Add fallback fonts in pdfium (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_font/include/cpdf_font.h » ('j') | core/fpdfapi/fpdf_font/include/cpdf_font.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698