Chromium Code Reviews| Index: core/fpdfapi/fpdf_font/cpdf_font.cpp |
| diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp |
| index 8101bd49a65eab2364ec6cd611466b9eac8e87bc..69fd72032b01934f727656d995d707094ba7242c 100644 |
| --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp |
| +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp |
| @@ -451,3 +451,24 @@ const FX_CHAR* CPDF_Font::GetAdobeCharName( |
| name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); |
| return name && name[0] ? name : nullptr; |
| } |
| + |
| +uint32_t CPDF_Font::FallbackFontFromCharcode(uint32_t charcode, |
| + bool* pVertGlyph) { |
| + if (m_FontFallbacks.size() < 1) { |
|
Lei Zhang
2016/08/24 04:43:10
m_FontFallbacks.empty()
npm
2016/08/24 14:39:22
Done.
|
| + 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.
|
| + m_FontFallbacks[0]->LoadSubst("Arial", IsTrueTypeFont(), m_Flags, |
| + m_StemV * 5, m_ItalicAngle, 0, |
| + IsVertWriting()); |
| + } |
| + 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
|
| +} |
| + |
| +int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, |
| + uint32_t charcode, |
| + 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
|
| + int glyph = |
| + 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
|
| + if (glyph == 0 || glyph == 0xffff) |
| + return -1; |
| + return glyph; |
| +} |