-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaeasy_fonts.h
More file actions
executable file
·115 lines (99 loc) · 4.72 KB
/
Copy pathaeasy_fonts.h
File metadata and controls
executable file
·115 lines (99 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* --------------------------------------------------------------------------------------------
* aeasy_fonts.h
* --------------------------------------------------------------------------------------------
* DESCRIPTION: Class declarations for the font handling objects:
* --------------------------------------------------------------------------------------------
* COPYRIGHT: Copyright (c) 2005-2013
* Clive Levinson <clivel@bundu.com>
* Bundu Technology Ltd.
* --------------------------------------------------------------------------------------------
* LICENCE: AlbumEasy is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your option)
* any later version.
* --------------------------------------------------------------------------------------------
* AUTHORS: Clive Levinson
* --------------------------------------------------------------------------------------------
* REVISIONS: Date Version Who Comment
*
* 2011/04/26 3.0 cl First QT Version
* -------------------------------------------------------------------------------------------- */
#ifndef _AEASY_FONTS_H
#define _AEASY_FONTS_H
#include "AlbumEasy.h"
#include <hpdf.h>
class CFontFileList;
class CFontFileInfo;
/************************************************************************************************
CFontManager: maintains the relationship between fonts defined in the album and the actual
font file and code page used by libharu
************************************************************************************************/
class CFontManager:public QObject
{
public:
static void initialise(void);
static bool addUserDefinedFont(CFontFileList *fontFiles,QString fontId,QString fontName,
QString encoding);
static int getFontIndex(QString fontId);
static HPDF_Font getFont(HPDF_Doc pdfDoc,int index);
static QTextCodec *getCodec(int index);
static QString getError(void) {return m_error;};
private:
static QString m_error;
};
/************************************************************************************************
CFontFileList: list of CFontFileInfo records, one for each of the available TTF files
************************************************************************************************/
class CFontFileList:public QObject
{
Q_OBJECT
public:
CFontFileList(void){m_populated=false; m_badFontFiles=new QStringList;};
void populate(QWidget *parent,bool includeSystemFonts);
bool populated(void) {return m_populated;};
bool find(QString fontName,QString &fileName,QString &filePath);
int count(void) {return m_fontFileInfoRecs.count() ;};
CFontFileInfo *at(int idx);
QStringList *badFileList(void) {return m_badFontFiles; };
~CFontFileList();
signals:
void logMessage(QString text,QString colour="",bool bold=false);
private:
static bool sortByName(CFontFileInfo *f1, CFontFileInfo *f2);
bool contains(const QString fileName);
void parseFontFile(const QString fileName,const QString filePath);
QList<CFontFileInfo *> m_fontFileInfoRecs;
QStringList *m_badFontFiles;
bool m_populated;
};
/************************************************************************************************
CFontPathList: list of paths to search for TTF files
************************************************************************************************/
class CFontPathList:public QStringList
{
public:
void populate(bool includeSystemFonts);
private:
void append(QString path);
void parseLinuxFontConfigFile(QString file);
};
/************************************************************************************************
CFontFileInfo: contains the font name, file name, and code pages
************************************************************************************************/
class CFontFileInfo
{
public:
void setFileDetails(QString fontName,QString fileName,QString filePath,quint32 codePageRange1,
quint32 codePageRange2);
QString fileName(void) {return m_fileName;};
QString filePath(void) {return m_filePath;};
QString fontName(void) {return m_fontName;};
void availableCodePages(QString &codePages);
private:
QString m_fontName; //name to display to the user
QString m_fileName; //name of the .ttf file
QString m_filePath; //path to the .ttf file
quint32 m_codePageRange1;
quint32 m_codePageRange2;
};
#endif // _AEASY_FONTS_H