Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:26:10

0001 //========================================================================
0002 //
0003 // SplashFontFile.h
0004 //
0005 //========================================================================
0006 
0007 //========================================================================
0008 //
0009 // Modified under the Poppler project - http://poppler.freedesktop.org
0010 //
0011 // All changes made under the Poppler project to this file are licensed
0012 // under GPL version 2 or later
0013 //
0014 // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
0015 // Copyright (C) 2008, 2010, 2018 Albert Astals Cid <aacid@kde.org>
0016 // Copyright (C) 2022 Oliver Sander <oliver.sander@tu-dresden.de>
0017 //
0018 // To see a description of the changes please see the Changelog file that
0019 // came with your tarball or type make ChangeLog if you are building from git
0020 //
0021 //========================================================================
0022 
0023 #ifndef SPLASHFONTFILE_H
0024 #define SPLASHFONTFILE_H
0025 
0026 #include <string>
0027 #include <vector>
0028 
0029 #include "SplashTypes.h"
0030 #include "poppler_private_export.h"
0031 
0032 class SplashFontEngine;
0033 class SplashFont;
0034 class SplashFontFileID;
0035 
0036 //------------------------------------------------------------------------
0037 // SplashFontFile
0038 //------------------------------------------------------------------------
0039 
0040 class POPPLER_PRIVATE_EXPORT SplashFontSrc
0041 {
0042 public:
0043     SplashFontSrc();
0044 
0045     SplashFontSrc(const SplashFontSrc &) = delete;
0046     SplashFontSrc &operator=(const SplashFontSrc &) = delete;
0047 
0048     void setFile(const std::string &file);
0049     void setBuf(char *bufA, int buflenA);
0050     void setBuf(std::vector<unsigned char> &&bufA);
0051 
0052     void ref();
0053     void unref();
0054 
0055     bool isFile;
0056     std::string fileName;
0057     std::vector<unsigned char> buf;
0058 
0059 private:
0060     ~SplashFontSrc();
0061     int refcnt;
0062 };
0063 
0064 class SplashFontFile
0065 {
0066 public:
0067     virtual ~SplashFontFile();
0068 
0069     SplashFontFile(const SplashFontFile &) = delete;
0070     SplashFontFile &operator=(const SplashFontFile &) = delete;
0071 
0072     // Create a new SplashFont, i.e., a scaled instance of this font
0073     // file.
0074     virtual SplashFont *makeFont(SplashCoord *mat, const SplashCoord *textMat) = 0;
0075 
0076     // Get the font file ID.
0077     SplashFontFileID *getID() { return id; }
0078 
0079     // Increment the reference count.
0080     void incRefCnt();
0081 
0082     // Decrement the reference count.  If the new value is zero, delete
0083     // the SplashFontFile object.
0084     void decRefCnt();
0085 
0086     bool doAdjustMatrix;
0087 
0088 protected:
0089     SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA);
0090 
0091     SplashFontFileID *id;
0092     SplashFontSrc *src;
0093     int refCnt;
0094 
0095     friend class SplashFontEngine;
0096 };
0097 
0098 #endif