EPUBFontManager.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libepubgen project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_EPUBFONTMANAGER_H
11 #define INCLUDED_EPUBFONTMANAGER_H
12 
13 #include <unordered_map>
14 #include <unordered_set>
15 
16 #include <boost/functional/hash.hpp>
17 
18 #include <librevenge/librevenge.h>
19 
20 #include "EPUBCSSProperties.h"
21 #include "EPUBCounter.h"
22 #include "EPUBPath.h"
23 
24 namespace libepubgen
25 {
26 
27 class EPUBManifest;
28 class EPUBPackage;
29 class EPUBCSSContent;
30 
33 {
34  // disable copying
37 
38  struct BinaryDataHash // : public std::unary_function<librevenge::RVNGBinaryData, std::size_t>
39  {
40  std::size_t operator()(const librevenge::RVNGBinaryData &data) const;
41  };
42 
43  struct BinaryDataEqual // : public std::binary_function<librevenge::RVNGBinaryData, librevenge::RVNGBinaryData, bool>
44  {
45  bool operator()(const librevenge::RVNGBinaryData &left, const librevenge::RVNGBinaryData &right) const;
46  };
47 
48  typedef std::unordered_map<librevenge::RVNGBinaryData, EPUBPath, BinaryDataHash, BinaryDataEqual> MapType_t;
49  typedef std::unordered_set<EPUBCSSProperties, boost::hash<EPUBCSSProperties>> SetType_t;
50 
51 public:
52  explicit EPUBFontManager(EPUBManifest &manifest);
53 
54  void insert(const librevenge::RVNGPropertyList &propertyList, const EPUBPath &path);
55 
56  void writeTo(EPUBPackage &package);
57 
59  void send(EPUBCSSContent &out);
60 
61 private:
63  void extractFontProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
64 
71 };
72 
73 }
74 
75 #endif // INCLUDED_EPUBFONTMANAGER
76 
77 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libepubgen::EPUBFontManager::extractFontProperties
void extractFontProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBFontManager.cpp:118
libepubgen::EPUBBinaryContent::insertBinaryData
void insertBinaryData(const librevenge::RVNGBinaryData &data)
Definition: EPUBBinaryContent.cpp:22
libepubgen::EPUBFontManager::writeTo
void writeTo(EPUBPackage &package)
Definition: EPUBFontManager.cpp:134
EPUBManifest.h
libepubgen::EPUBCSSContent
Definition: EPUBCSSContent.h:23
libepubgen::EPUBDrawingGenerator::Impl::Impl
Impl(EPUBPackage *const package, int version)
Definition: EPUBDrawingGenerator.cpp:29
libepubgen::EPUBFontManager::insert
void insert(const librevenge::RVNGPropertyList &propertyList, const EPUBPath &path)
Definition: EPUBFontManager.cpp:76
libepubgen::EPUBFontManager::m_map
MapType_t m_map
Font filename -> content map.
Definition: EPUBFontManager.h:67
libepubgen::EPUBCSSContent::insertRule
void insertRule(const librevenge::RVNGString &selector, const librevenge::RVNGPropertyList &properties)
Definition: EPUBCSSContent.cpp:22
libepubgen::EPUBBinaryContent::writeTo
void writeTo(EPUBPackage &package, const char *name)
Definition: EPUBBinaryContent.cpp:27
libepubgen::fillPropertyList
void fillPropertyList(const EPUBCSSProperties &cssProps, librevenge::RVNGPropertyList &props)
Definition: EPUBCSSProperties.cpp:15
libepubgen
Definition: EPUBBinaryContent.cpp:14
libepubgen::EPUBBinaryContent
Definition: EPUBBinaryContent.h:20
libepubgen::EPUBFontManager::SetType_t
std::unordered_set< EPUBCSSProperties, boost::hash< EPUBCSSProperties > > SetType_t
Definition: EPUBFontManager.h:49
EPUBFontManager.h
libepubgen::EPUBCounter
Definition: EPUBCounter.h:16
libepubgen::EPUBCSSProperties
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
libepubgen::EPUBCounter::next
unsigned next()
Definition: EPUBCounter.cpp:25
libepubgen::EPUBManifest::insert
void insert(const EPUBPath &path, const std::string &mimetype, const std::string &id, const std::string &properties)
Definition: EPUBManifest.cpp:25
EPUBCSSContent.h
EPUBCSSProperties.h
libepubgen::EPUBFontManager::EPUBFontManager
EPUBFontManager(const EPUBFontManager &)
libepubgen::EPUBFontManager::BinaryDataHash::operator()
std::size_t operator()(const librevenge::RVNGBinaryData &data) const
Definition: EPUBFontManager.cpp:47
libepubgen::EPUBDrawingGenerator::Impl
Definition: EPUBDrawingGenerator.cpp:23
libepubgen::EPUBFontManager::m_manifest
EPUBManifest & m_manifest
Definition: EPUBFontManager.h:65
libepubgen::EPUBFontManager::operator=
EPUBFontManager & operator=(const EPUBFontManager &)
libepubgen::EPUBPath
Representation of a path in the package.
Definition: EPUBPath.h:21
EPUBPath.h
libepubgen::EPUBFontManager::BinaryDataEqual
Definition: EPUBFontManager.h:43
EPUBCounter.h
libepubgen::EPUBFontManager::BinaryDataHash
Definition: EPUBFontManager.h:38
libepubgen::EPUBPath::str
const std::string str() const
Definition: EPUBPath.cpp:87
EPUBPagedGenerator.h
libepubgen::EPUBFontManager
Manages embedded fonts.
Definition: EPUBFontManager.h:32
libepubgen::EPUBFontManager::MapType_t
std::unordered_map< librevenge::RVNGBinaryData, EPUBPath, BinaryDataHash, BinaryDataEqual > MapType_t
Definition: EPUBFontManager.h:48
libepubgen::EPUBFontManager::BinaryDataEqual::operator()
bool operator()(const librevenge::RVNGBinaryData &left, const librevenge::RVNGBinaryData &right) const
Definition: EPUBFontManager.cpp:58
libepubgen::EPUBFontManager::m_set
SetType_t m_set
Set of font properties.
Definition: EPUBFontManager.h:70
libepubgen::EPUBPagedGenerator
Definition: EPUBPagedGenerator.h:25
libepubgen::EPUBManifest
Definition: EPUBManifest.h:23
EPUBBinaryContent.h
libepubgen::EPUBFontManager::send
void send(EPUBCSSContent &out)
send the data to the sink
Definition: EPUBFontManager.cpp:144
libepubgen::EPUBFontManager::m_number
EPUBCounter m_number
Definition: EPUBFontManager.h:68

Generated for libepubgen by doxygen 1.8.16