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

Side by Side Diff: core/fpdfapi/font/cpdf_cidfont.cpp

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « core/fpdfapi/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/font/fpdf_font.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/font/cpdf_cidfont.h" 7 #include "core/fpdfapi/font/cpdf_cidfont.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (pEncoding->IsName()) { 355 if (pEncoding->IsName()) {
356 CFX_ByteString cmap = pEncoding->GetString(); 356 CFX_ByteString cmap = pEncoding->GetString();
357 bool bPromptCJK = m_pFontFile && m_bType1; 357 bool bPromptCJK = m_pFontFile && m_bType1;
358 m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK); 358 m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK);
359 if (!m_pCMap) 359 if (!m_pCMap)
360 return false; 360 return false;
361 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { 361 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) {
362 m_pCMap = new CPDF_CMap; 362 m_pCMap = new CPDF_CMap;
363 m_pAllocatedCMap.reset(m_pCMap); 363 m_pAllocatedCMap.reset(m_pCMap);
364 CPDF_StreamAcc acc; 364 CPDF_StreamAcc acc;
365 acc.LoadAllData(pStream, FALSE); 365 acc.LoadAllData(pStream, false);
366 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); 366 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
367 } else { 367 } else {
368 return false; 368 return false;
369 } 369 }
370 370
371 m_Charset = m_pCMap->m_Charset; 371 m_Charset = m_pCMap->m_Charset;
372 if (m_Charset == CIDSET_UNKNOWN) { 372 if (m_Charset == CIDSET_UNKNOWN) {
373 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictFor("CIDSystemInfo"); 373 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictFor("CIDSystemInfo");
374 if (pCIDInfo) { 374 if (pCIDInfo) {
375 m_Charset = 375 m_Charset =
(...skipping 16 matching lines...) Expand all
392 if (pWidthArray) 392 if (pWidthArray)
393 LoadMetricsArray(pWidthArray, m_WidthList, 1); 393 LoadMetricsArray(pWidthArray, m_WidthList, 1);
394 if (!IsEmbedded()) 394 if (!IsEmbedded())
395 LoadSubstFont(); 395 LoadSubstFont();
396 396
397 if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { 397 if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) {
398 CPDF_Object* pmap = pCIDFontDict->GetDirectObjectFor("CIDToGIDMap"); 398 CPDF_Object* pmap = pCIDFontDict->GetDirectObjectFor("CIDToGIDMap");
399 if (pmap) { 399 if (pmap) {
400 if (CPDF_Stream* pStream = pmap->AsStream()) { 400 if (CPDF_Stream* pStream = pmap->AsStream()) {
401 m_pStreamAcc.reset(new CPDF_StreamAcc); 401 m_pStreamAcc.reset(new CPDF_StreamAcc);
402 m_pStreamAcc->LoadAllData(pStream, FALSE); 402 m_pStreamAcc->LoadAllData(pStream, false);
403 } else if (pmap->GetString() == "Identity") { 403 } else if (pmap->GetString() == "Identity") {
404 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 404 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
405 if (m_pFontFile) 405 if (m_pFontFile)
406 m_bCIDIsGID = true; 406 m_bCIDIsGID = true;
407 #else 407 #else
408 m_bCIDIsGID = true; 408 m_bCIDIsGID = true;
409 #endif 409 #endif
410 } 410 }
411 } 411 }
412 } 412 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return index; 593 return index;
594 594
595 index = vindex; 595 index = vindex;
596 if (pVertGlyph) 596 if (pVertGlyph)
597 *pVertGlyph = true; 597 *pVertGlyph = true;
598 return index; 598 return index;
599 } 599 }
600 600
601 int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { 601 int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
602 if (pVertGlyph) 602 if (pVertGlyph)
603 *pVertGlyph = FALSE; 603 *pVertGlyph = false;
604 604
605 if (!m_pFontFile && !m_pStreamAcc) { 605 if (!m_pFontFile && !m_pStreamAcc) {
606 uint16_t cid = CIDFromCharCode(charcode); 606 uint16_t cid = CIDFromCharCode(charcode);
607 FX_WCHAR unicode = 0; 607 FX_WCHAR unicode = 0;
608 if (m_bCIDIsGID) { 608 if (m_bCIDIsGID) {
609 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 609 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
610 return cid; 610 return cid;
611 #else 611 #else
612 if (m_Flags & PDFFONT_SYMBOLIC) 612 if (m_Flags & PDFFONT_SYMBOLIC)
613 return cid; 613 return cid;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 843 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
844 return nullptr; 844 return nullptr;
845 845
846 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs); 846 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs);
847 const auto* pTransform = std::lower_bound( 847 const auto* pTransform = std::lower_bound(
848 g_Japan1_VertCIDs, pEnd, CID, 848 g_Japan1_VertCIDs, pEnd, CID,
849 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; }); 849 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; });
850 return (pTransform < pEnd && CID == pTransform->cid) ? &pTransform->a 850 return (pTransform < pEnd && CID == pTransform->cid) ? &pTransform->a
851 : nullptr; 851 : nullptr;
852 } 852 }
OLDNEW
« no previous file with comments | « core/fpdfapi/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698