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

Side by Side Diff: core/src/fxge/android/fx_android_font.cpp

Issue 1265503005: clang-format all pdfium code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh 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 "fx_fpf.h" 7 #include "fx_fpf.h"
8 #if _FX_OS_ == _FX_ANDROID_ 8 #if _FX_OS_ == _FX_ANDROID_
9 CFX_AndroidFontInfo::CFX_AndroidFontInfo() 9 CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(NULL) {}
10 : m_pFontMgr(NULL) 10 FX_BOOL CFX_AndroidFontInfo::Init(IFPF_FontMgr* pFontMgr) {
11 { 11 if (!pFontMgr) {
12 return FALSE;
13 }
14 pFontMgr->LoadSystemFonts();
15 m_pFontMgr = pFontMgr;
16 return TRUE;
12 } 17 }
13 FX_BOOL CFX_AndroidFontInfo::Init(IFPF_FontMgr *pFontMgr) 18 FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
14 { 19 return FALSE;
15 if (!pFontMgr) {
16 return FALSE;
17 }
18 pFontMgr->LoadSystemFonts();
19 m_pFontMgr = pFontMgr;
20 return TRUE;
21 } 20 }
22 FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) 21 void* CFX_AndroidFontInfo::MapFont(int weight,
23 { 22 FX_BOOL bItalic,
23 int charset,
24 int pitch_family,
25 const FX_CHAR* face,
26 int& iExact) {
27 if (!m_pFontMgr) {
28 return NULL;
29 }
30 FX_DWORD dwStyle = 0;
31 if (weight >= 700) {
32 dwStyle |= FXFONT_BOLD;
33 }
34 if (bItalic) {
35 dwStyle |= FXFONT_ITALIC;
36 }
37 if (pitch_family & FXFONT_FF_FIXEDPITCH) {
38 dwStyle |= FXFONT_FIXED_PITCH;
39 }
40 if (pitch_family & FXFONT_FF_SCRIPT) {
41 dwStyle |= FXFONT_SCRIPT;
42 }
43 if (pitch_family & FXFONT_FF_ROMAN) {
44 dwStyle |= FXFONT_SERIF;
45 }
46 return m_pFontMgr->CreateFont(face, charset, dwStyle,
47 FPF_MATCHFONT_REPLACEANSI);
48 }
49 void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) {
50 return NULL;
51 }
52 FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont,
53 FX_DWORD table,
54 uint8_t* buffer,
55 FX_DWORD size) {
56 if (!hFont) {
57 return 0;
58 }
59 return ((IFPF_Font*)hFont)->GetFontData(table, buffer, size);
60 }
61 FX_BOOL CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
62 if (!hFont) {
24 return FALSE; 63 return FALSE;
64 }
65 name = ((IFPF_Font*)hFont)->GetFamilyName();
66 return TRUE;
25 } 67 }
26 void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, int& iExact) 68 FX_BOOL CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
27 { 69 if (!hFont) {
28 if (!m_pFontMgr) { 70 return FALSE;
29 return NULL; 71 }
30 } 72 charset = ((IFPF_Font*)hFont)->GetCharset();
31 FX_DWORD dwStyle = 0; 73 return FALSE;
32 if (weight >= 700) {
33 dwStyle |= FXFONT_BOLD;
34 }
35 if (bItalic) {
36 dwStyle |= FXFONT_ITALIC;
37 }
38 if (pitch_family & FXFONT_FF_FIXEDPITCH) {
39 dwStyle |= FXFONT_FIXED_PITCH;
40 }
41 if (pitch_family & FXFONT_FF_SCRIPT) {
42 dwStyle |= FXFONT_SCRIPT;
43 }
44 if (pitch_family & FXFONT_FF_ROMAN) {
45 dwStyle |= FXFONT_SERIF;
46 }
47 return m_pFontMgr->CreateFont(face, charset, dwStyle, FPF_MATCHFONT_REPLACEA NSI);
48 } 74 }
49 void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) 75 void CFX_AndroidFontInfo::DeleteFont(void* hFont) {
50 { 76 if (!hFont) {
51 return NULL; 77 return;
78 }
79 ((IFPF_Font*)hFont)->Release();
52 } 80 }
53 FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) 81 void* CFX_AndroidFontInfo::RetainFont(void* hFont) {
54 { 82 return NULL;
55 if (!hFont) {
56 return 0;
57 }
58 return ((IFPF_Font*)hFont)->GetFontData(table, buffer, size);
59 }
60 FX_BOOL CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name)
61 {
62 if (!hFont) {
63 return FALSE;
64 }
65 name = ((IFPF_Font*)hFont)->GetFamilyName();
66 return TRUE;
67 }
68 FX_BOOL CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset)
69 {
70 if (!hFont) {
71 return FALSE;
72 }
73 charset = ((IFPF_Font*)hFont)->GetCharset();
74 return FALSE;
75 }
76 void CFX_AndroidFontInfo::DeleteFont(void* hFont)
77 {
78 if (!hFont) {
79 return;
80 }
81 ((IFPF_Font*)hFont)->Release();
82 }
83 void* CFX_AndroidFontInfo::RetainFont(void* hFont)
84 {
85 return NULL;
86 } 83 }
87 #endif 84 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698