Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 "fpdfsdk/pdfwindow/PWL_FontMap.h" | 7 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 "Helvetica-Oblique", | 27 "Helvetica-Oblique", |
| 28 "Times-Roman", | 28 "Times-Roman", |
| 29 "Times-Bold", | 29 "Times-Bold", |
| 30 "Times-Italic", | 30 "Times-Italic", |
| 31 "Times-BoldItalic", | 31 "Times-BoldItalic", |
| 32 "Symbol", | 32 "Symbol", |
| 33 "ZapfDingbats"}; | 33 "ZapfDingbats"}; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) | 37 CPWL_FontMap::CPWL_FontMap(CFX_SystemHandler* pSystemHandler) |
| 38 : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { | 38 : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { |
| 39 ASSERT(m_pSystemHandler); | 39 ASSERT(m_pSystemHandler); |
| 40 } | 40 } |
| 41 | 41 |
| 42 CPWL_FontMap::~CPWL_FontMap() { | 42 CPWL_FontMap::~CPWL_FontMap() { |
| 43 delete m_pPDFDoc; | 43 delete m_pPDFDoc; |
| 44 m_pPDFDoc = NULL; | 44 m_pPDFDoc = NULL; |
| 45 | 45 |
| 46 Empty(); | 46 Empty(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void CPWL_FontMap::SetSystemHandler(IFX_SystemHandler* pSystemHandler) { | 49 void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) { |
| 50 m_pSystemHandler = pSystemHandler; | 50 m_pSystemHandler = pSystemHandler; |
| 51 } | 51 } |
| 52 | 52 |
| 53 CPDF_Document* CPWL_FontMap::GetDocument() { | 53 CPDF_Document* CPWL_FontMap::GetDocument() { |
| 54 if (!m_pPDFDoc) { | 54 if (!m_pPDFDoc) { |
| 55 if (CPDF_ModuleMgr::Get()) { | 55 if (CPDF_ModuleMgr::Get()) { |
| 56 m_pPDFDoc = new CPDF_Document; | 56 m_pPDFDoc = new CPDF_Document; |
| 57 m_pPDFDoc->CreateNewDoc(); | 57 m_pPDFDoc->CreateNewDoc(); |
| 58 } | 58 } |
| 59 } | 59 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 | 277 |
| 278 CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) { | 278 CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) { |
| 279 if (nCharset == DEFAULT_CHARSET) | 279 if (nCharset == DEFAULT_CHARSET) |
| 280 nCharset = GetNativeCharset(); | 280 nCharset = GetNativeCharset(); |
| 281 | 281 |
| 282 CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset); | 282 CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset); |
| 283 if (m_pSystemHandler) { | 283 if (m_pSystemHandler) { |
| 284 if (m_pSystemHandler->FindNativeTrueTypeFont(nCharset, sFontName)) | 284 if (m_pSystemHandler->FindNativeTrueTypeFont(nCharset, sFontName)) |
| 285 return sFontName; | 285 return sFontName; |
| 286 | 286 |
| 287 sFontName = m_pSystemHandler->GetNativeTrueTypeFont(nCharset); | 287 sFontName = ""; |
|
dsinclair
2016/04/26 20:58:03
GetNativeTrueTypeFont always returns ""
| |
| 288 } | 288 } |
| 289 return sFontName; | 289 return sFontName; |
| 290 } | 290 } |
| 291 | 291 |
| 292 CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, | 292 CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, |
| 293 CFX_ByteString& sFontName, | 293 CFX_ByteString& sFontName, |
| 294 uint8_t nCharset) { | 294 uint8_t nCharset) { |
| 295 if (IsStandardFont(sFontName)) | 295 if (IsStandardFont(sFontName)) |
| 296 return AddStandardFont(pDoc, sFontName); | 296 return AddStandardFont(pDoc, sFontName); |
| 297 | 297 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 | 484 |
| 485 if (word >= 0x0100 && word <= 0x024F) | 485 if (word >= 0x0100 && word <= 0x024F) |
| 486 return EASTEUROPE_CHARSET; | 486 return EASTEUROPE_CHARSET; |
| 487 | 487 |
| 488 if (word >= 0x1E00 && word <= 0x1EFF) | 488 if (word >= 0x1E00 && word <= 0x1EFF) |
| 489 return VIETNAMESE_CHARSET; | 489 return VIETNAMESE_CHARSET; |
| 490 | 490 |
| 491 return ANSI_CHARSET; | 491 return ANSI_CHARSET; |
| 492 } | 492 } |
| 493 | 493 |
| 494 CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, | 494 CPWL_DocFontMap::CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler, |
| 495 CPDF_Document* pAttachedDoc) | 495 CPDF_Document* pAttachedDoc) |
| 496 : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {} | 496 : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {} |
| 497 | 497 |
| 498 CPWL_DocFontMap::~CPWL_DocFontMap() {} | 498 CPWL_DocFontMap::~CPWL_DocFontMap() {} |
| 499 | 499 |
| 500 CPDF_Document* CPWL_DocFontMap::GetDocument() { | 500 CPDF_Document* CPWL_DocFontMap::GetDocument() { |
| 501 return m_pAttachedDoc; | 501 return m_pAttachedDoc; |
| 502 } | 502 } |
| OLD | NEW |