1//========================================================================
2//
3// SplashFontFile.h
4//
5//========================================================================
6
7//========================================================================
8//
9// Modified under the Poppler project - http://poppler.freedesktop.org
10//
11// All changes made under the Poppler project to this file are licensed
12// under GPL version 2 or later
13//
14// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
15// Copyright (C) 2008, 2010, 2018 Albert Astals Cid <aacid@kde.org>
16// Copyright (C) 2022 Oliver Sander <oliver.sander@tu-dresden.de>
17//
18// To see a description of the changes please see the Changelog file that
19// came with your tarball or type make ChangeLog if you are building from git
20//
21//========================================================================
22
23#ifndef SPLASHFONTFILE_H
24#define SPLASHFONTFILE_H
25
26#include <string>
27#include <vector>
28
29#include "SplashTypes.h"
30#include "poppler_private_export.h"
31
32class SplashFontEngine;
33class SplashFont;
34class SplashFontFileID;
35
36//------------------------------------------------------------------------
37// SplashFontFile
38//------------------------------------------------------------------------
39
40class POPPLER_PRIVATE_EXPORT SplashFontSrc
41{
42public:
43 SplashFontSrc();
44
45 SplashFontSrc(const SplashFontSrc &) = delete;
46 SplashFontSrc &operator=(const SplashFontSrc &) = delete;
47
48 void setFile(const std::string &file);
49 void setBuf(char *bufA, int buflenA);
50 void setBuf(std::vector<unsigned char> &&bufA);
51
52 void ref();
53 void unref();
54
55 bool isFile;
56 std::string fileName;
57 std::vector<unsigned char> buf;
58
59private:
60 ~SplashFontSrc();
61 int refcnt;
62};
63
64class SplashFontFile
65{
66public:
67 virtual ~SplashFontFile();
68
69 SplashFontFile(const SplashFontFile &) = delete;
70 SplashFontFile &operator=(const SplashFontFile &) = delete;
71
72 // Create a new SplashFont, i.e., a scaled instance of this font
73 // file.
74 virtual SplashFont *makeFont(SplashCoord *mat, const SplashCoord *textMat) = 0;
75
76 // Get the font file ID.
77 SplashFontFileID *getID() { return id; }
78
79 // Increment the reference count.
80 void incRefCnt();
81
82 // Decrement the reference count. If the new value is zero, delete
83 // the SplashFontFile object.
84 void decRefCnt();
85
86 bool doAdjustMatrix;
87
88protected:
89 SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA);
90
91 SplashFontFileID *id;
92 SplashFontSrc *src;
93 int refCnt;
94
95 friend class SplashFontEngine;
96};
97
98#endif
99

source code of poppler/splash/SplashFontFile.h