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

Side by Side Diff: core/src/fxge/ge/fx_ge_fontmap.cpp

Issue 1542213002: Merge to XFA: Start using allowed C++11 features. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: fix mac/win Created 5 years 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/src/fxcodec/jbig2/JBig2_SddProc.cpp ('k') | samples/image_diff.cc » ('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 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 <limits> 7 #include <limits>
8 #include <vector>
8 9
9 #include "core/include/fxge/fx_freetype.h" 10 #include "core/include/fxge/fx_freetype.h"
10 #include "core/include/fxge/fx_ge.h" 11 #include "core/include/fxge/fx_ge.h"
11 #include "core/src/fxge/fontdata/chromefontdata/chromefontdata.h" 12 #include "core/src/fxge/fontdata/chromefontdata/chromefontdata.h"
12 #include "core/src/fxge/ge/text_int.h" 13 #include "core/src/fxge/ge/text_int.h"
13 #include "third_party/base/stl_util.h" 14 #include "third_party/base/stl_util.h"
14 15
15 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) 16 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1])
16 #define GET_TT_LONG(w) \ 17 #define GET_TT_LONG(w) \
17 (FX_DWORD)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) 18 (FX_DWORD)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3])
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 705
705 CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) { 706 CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
706 if (!m_pFontInfo) 707 if (!m_pFontInfo)
707 return CFX_ByteString(); 708 return CFX_ByteString();
708 709
709 FX_DWORD size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); 710 FX_DWORD size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0);
710 if (!size) 711 if (!size)
711 return CFX_ByteString(); 712 return CFX_ByteString();
712 713
713 std::vector<uint8_t> buffer(size); 714 std::vector<uint8_t> buffer(size);
714 uint8_t* buffer_ptr = pdfium::vector_as_array(&buffer); 715 uint8_t* buffer_ptr = buffer.data();
715 FX_DWORD bytes_read = 716 FX_DWORD bytes_read =
716 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); 717 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size);
717 return (bytes_read == size) ? GetNameFromTT(buffer_ptr, 6) : CFX_ByteString(); 718 return (bytes_read == size) ? GetNameFromTT(buffer_ptr, 6) : CFX_ByteString();
718 } 719 }
719 720
720 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { 721 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
721 if (!m_pFontInfo) { 722 if (!m_pFontInfo) {
722 return; 723 return;
723 } 724 }
724 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { 725 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) {
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 int PDF_GetStandardFontName(CFX_ByteString* name) { 1594 int PDF_GetStandardFontName(CFX_ByteString* name) {
1594 AltFontName* found = static_cast<AltFontName*>( 1595 AltFontName* found = static_cast<AltFontName*>(
1595 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), 1596 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
1596 sizeof(AltFontName), CompareString)); 1597 sizeof(AltFontName), CompareString));
1597 if (!found) 1598 if (!found)
1598 return -1; 1599 return -1;
1599 1600
1600 *name = g_Base14FontNames[found->m_Index]; 1601 *name = g_Base14FontNames[found->m_Index];
1601 return found->m_Index; 1602 return found->m_Index;
1602 } 1603 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_SddProc.cpp ('k') | samples/image_diff.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698