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

Side by Side Diff: core/src/fpdfapi/fpdf_font/ttgsubtable.cpp

Issue 1293973002: Cleanup CFX_Font a bit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Remove LoadFile() Created 5 years, 4 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 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 "../../../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../../../third_party/base/nonstd_unique_ptr.h"
8 #include "../../../include/fxge/fx_ge.h" 8 #include "../../../include/fxge/fx_ge.h"
9 #include "../../../include/fxge/fx_freetype.h" 9 #include "../../../include/fxge/fx_freetype.h"
10 #include "ttgsubtable.h" 10 #include "ttgsubtable.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, 389 FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum,
390 FX_DWORD* vglyphnum) { 390 FX_DWORD* vglyphnum) {
391 return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum); 391 return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum);
392 } 392 }
393 // static 393 // static
394 IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) { 394 IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) {
395 if (!pFont) { 395 if (!pFont) {
396 return NULL; 396 return NULL;
397 } 397 }
398 if (NULL == pFont->m_pGsubData) { 398 if (!pFont->GetSubData()) {
399 unsigned long length = 0; 399 unsigned long length = 0;
400 int error = FXFT_Load_Sfnt_Table( 400 int error = FXFT_Load_Sfnt_Table(
401 pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); 401 pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length);
402 if (!error) { 402 if (!error) {
403 pFont->m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); 403 pFont->SetSubData((uint8_t*)FX_Alloc(uint8_t, length));
404 } 404 }
405 if (!pFont->m_pGsubData) { 405 if (!pFont->GetSubData()) {
406 return NULL; 406 return NULL;
407 } 407 }
408 } 408 }
409 int error = 409 int error =
410 FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, 410 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
411 pFont->m_pGsubData, NULL); 411 pFont->GetSubData(), NULL);
412 if (!error && pFont->m_pGsubData) { 412 if (!error && pFont->GetSubData()) {
413 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); 413 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable);
414 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { 414 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) {
415 return pGsubTable.release(); 415 return pGsubTable.release();
416 } 416 }
417 } 417 }
418 return NULL; 418 return NULL;
419 } 419 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698