LibreOffice Module vcl (master)  1
embeddedfontshelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice 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_VCL_EMBEDDEDFONTSHELPER_HXX
11 #define INCLUDED_VCL_EMBEDDEDFONTSHELPER_HXX
12 
13 #include <vcl/dllapi.h>
14 
15 #include <rtl/ustring.hxx>
16 #include <tools/fontenum.hxx>
17 #include <tools/long.hxx>
18 
19 #include <string_view>
20 #include <vector>
21 
22 namespace com::sun::star::io { class XInputStream; }
23 namespace com::sun::star::uno { template <typename > class Reference; }
24 
30 {
31 private:
32  std::vector<std::pair<OUString, OUString>> m_aAccumulatedFonts;
33 
41  static void activateFont( const OUString& fontName, const OUString& fileUrl );
42 
43 public:
45  enum class FontRights
46  {
47  ViewingAllowed,
48  EditingAllowed
49  };
50 
54  static OUString fontFileUrl(
55  std::u16string_view familyName, FontFamily family, FontItalic italic,
56  FontWeight weight, FontPitch pitch, FontRights rights );
57 
67  bool addEmbeddedFont( const css::uno::Reference< css::io::XInputStream >& stream,
68  const OUString& fontName, const char* extra,
69  std::vector< unsigned char > const & key, bool eot = false);
70 
79  static OUString fileUrlForTemporaryFont( const OUString& fontName, const char* extra );
80 
85  void activateFonts();
86 
94  static bool sufficientTTFRights( const void* data, tools::Long size, FontRights rights );
95 
100  static void clearTemporaryFontFiles();
101 
102  ~EmbeddedFontsHelper() COVERITY_NOEXCEPT_FALSE
103  {
104  activateFonts();
105  }
106 };
107 
108 #endif
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
Reference
FontRights
Specification of what kind of operation is allowed when embedding a font.
FontPitch
FontFamily
FontWeight
~EmbeddedFontsHelper() COVERITY_NOEXCEPT_FALSE
std::vector< std::pair< OUString, OUString > > m_aAccumulatedFonts
Helper functions for handling embedded fonts in documents.
FontItalic