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

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

Issue 2448293002: Name core/fxge/android files appropriately and use one file per class (Closed)
Patch Set: Fix build 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
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "core/fxcrt/fx_system.h"
8
9 #if _FX_OS_ == _FX_ANDROID_
10
11 #include "core/fxge/android/fpf_skiafont.h"
12 #include "core/fxge/android/fpf_skiafontmgr.h"
13 #include "core/fxge/android/fx_android_font.h"
14 #include "core/fxge/cfx_fontmapper.h"
15
16 CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(nullptr) {}
17 CFX_AndroidFontInfo::~CFX_AndroidFontInfo() {}
18 FX_BOOL CFX_AndroidFontInfo::Init(CFPF_SkiaFontMgr* pFontMgr) {
19 if (!pFontMgr)
20 return FALSE;
21
22 pFontMgr->LoadSystemFonts();
23 m_pFontMgr = pFontMgr;
24 return TRUE;
25 }
26
27 FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
28 return FALSE;
29 }
30
31 void* CFX_AndroidFontInfo::MapFont(int weight,
32 FX_BOOL bItalic,
33 int charset,
34 int pitch_family,
35 const FX_CHAR* face,
36 int& iExact) {
37 if (!m_pFontMgr)
38 return nullptr;
39
40 uint32_t dwStyle = 0;
41 if (weight >= 700)
42 dwStyle |= FXFONT_BOLD;
43 if (bItalic)
44 dwStyle |= FXFONT_ITALIC;
45 if (pitch_family & FXFONT_FF_FIXEDPITCH)
46 dwStyle |= FXFONT_FIXED_PITCH;
47 if (pitch_family & FXFONT_FF_SCRIPT)
48 dwStyle |= FXFONT_SCRIPT;
49 if (pitch_family & FXFONT_FF_ROMAN)
50 dwStyle |= FXFONT_SERIF;
51 return m_pFontMgr->CreateFont(face, charset, dwStyle,
52 FPF_MATCHFONT_REPLACEANSI);
53 }
54
55 void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) {
56 return nullptr;
57 }
58
59 uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont,
60 uint32_t table,
61 uint8_t* buffer,
62 uint32_t size) {
63 if (!hFont)
64 return 0;
65 return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
66 }
67
68 FX_BOOL CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
69 if (!hFont)
70 return FALSE;
71
72 name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
73 return TRUE;
74 }
75
76 FX_BOOL CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
77 if (!hFont)
78 return FALSE;
79
80 charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
81 return FALSE;
82 }
83
84 void CFX_AndroidFontInfo::DeleteFont(void* hFont) {
85 if (!hFont)
86 return;
87
88 static_cast<CFPF_SkiaFont*>(hFont)->Release();
89 }
90
91 #endif // _FX_OS_ == _FX_ANDROID_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698