Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_folderfontinfo.h
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
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#ifndef CORE_FXGE_CFX_FOLDERFONTINFO_H_
8#define CORE_FXGE_CFX_FOLDERFONTINFO_H_
9
10#include <map>
11#include <memory>
12#include <vector>
13
14#include "core/fxcrt/fx_codepage_forward.h"
15#include "core/fxcrt/unowned_ptr.h"
16#include "core/fxge/cfx_fontmapper.h"
17#include "core/fxge/systemfontinfo_iface.h"
18
19#define CHARSET_FLAG_ANSI (1 << 0)
20#define CHARSET_FLAG_SYMBOL (1 << 1)
21#define CHARSET_FLAG_SHIFTJIS (1 << 2)
22#define CHARSET_FLAG_BIG5 (1 << 3)
23#define CHARSET_FLAG_GB (1 << 4)
24#define CHARSET_FLAG_KOREAN (1 << 5)
25
27 public:
29 ~CFX_FolderFontInfo() override;
30
31 void AddPath(const ByteString& path);
32
33 // SystemFontInfoIface:
34 bool EnumFontList(CFX_FontMapper* pMapper) override;
35 void* MapFont(int weight,
36 bool bItalic,
37 FX_Charset charset,
38 int pitch_family,
39 const ByteString& face) override;
40 void* GetFont(const ByteString& face) override;
41 size_t GetFontData(void* hFont,
42 uint32_t table,
43 pdfium::span<uint8_t> buffer) override;
44 void DeleteFont(void* hFont) override;
45 bool GetFaceName(void* hFont, ByteString* name) override;
46 bool GetFontCharset(void* hFont, FX_Charset* charset) override;
47
48 protected:
50
52 public:
53 static constexpr int32_t kSimilarityScoreMax = 68;
54
55 FontFaceInfo(ByteString filePath,
56 ByteString faceName,
57 ByteString fontTables,
58 uint32_t fontOffset,
59 uint32_t fileSize);
60
61 bool IsEligibleForFindFont(uint32_t flag, FX_Charset charset) const;
62 int32_t SimilarityScore(int weight,
63 bool italic,
64 int pitch_family,
65 bool exact_match_bonus) const;
66
70 const uint32_t m_FontOffset;
71 const uint32_t m_FileSize;
72 uint32_t m_Styles = 0;
73 uint32_t m_Charsets = 0;
74 };
75
76 void ScanPath(const ByteString& path);
77 void ScanFile(const ByteString& path);
78 void ReportFace(const ByteString& path,
79 FILE* pFile,
80 FX_FILESIZE filesize,
81 uint32_t offset);
82 void* GetSubstFont(const ByteString& face);
83 void* FindFont(int weight,
84 bool bItalic,
85 FX_Charset charset,
86 int pitch_family,
87 const ByteString& family,
88 bool bMatchName);
89
93};
94
95#endif // CORE_FXGE_CFX_FOLDERFONTINFO_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
void Init() override
std::unique_ptr< SystemFontInfoIface > CreateDefaultSystemFontInfo() override
void * CreatePlatformFont(pdfium::span< const uint8_t > font_span) override
~CApplePlatform() override
bool IsEligibleForFindFont(uint32_t flag, FX_Charset charset) const
int32_t SimilarityScore(int weight, bool italic, int pitch_family, bool exact_match_bonus) const
FontFaceInfo(ByteString filePath, ByteString faceName, ByteString fontTables, uint32_t fontOffset, uint32_t fileSize)
static constexpr int32_t kSimilarityScoreMax
~CFX_FolderFontInfo() override
void ScanFile(const ByteString &path)
bool GetFontCharset(void *hFont, FX_Charset *charset) override
std::vector< ByteString > m_PathList
size_t GetFontData(void *hFont, uint32_t table, pdfium::span< uint8_t > buffer) override
void * GetSubstFont(const ByteString &face)
void DeleteFont(void *hFont) override
UnownedPtr< CFX_FontMapper > m_pMapper
void * FindFont(int weight, bool bItalic, FX_Charset charset, int pitch_family, const ByteString &family, bool bMatchName)
void ReportFace(const ByteString &path, FILE *pFile, FX_FILESIZE filesize, uint32_t offset)
bool GetFaceName(void *hFont, ByteString *name) override
void ScanPath(const ByteString &path)
void * MapFont(int weight, bool bItalic, FX_Charset charset, int pitch_family, const ByteString &face) override
void AddPath(const ByteString &path)
void * GetFont(const ByteString &face) override
std::map< ByteString, std::unique_ptr< FontFaceInfo > > m_FontList
bool EnumFontList(CFX_FontMapper *pMapper) override
static CFX_GEModule * Get()
const char ** GetUserFontPaths() const
ByteString & operator+=(const char *str)
ByteString & operator=(const char *str)
ByteString & operator=(const ByteString &that)
ByteString & operator=(ByteString &&that) noexcept
#define UNSAFE_TODO(...)
FX_Charset
Definition fx_codepage.h:71
@ kChineseTraditional
Definition fx_codepage.h:91
@ kChineseSimplified
Definition fx_codepage.h:90
bool FontFamilyIsFixedPitch(uint32_t family)
Definition fx_font.h:86
bool FontFamilyIsRoman(uint32_t family)
Definition fx_font.h:89
#define FX_FILESIZE
Definition fx_types.h:19