LibreOffice Module vcl (master)  1
outdev.h
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  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_INC_OUTDEV_H
21 #define INCLUDED_VCL_INC_OUTDEV_H
22 
23 #include <set>
24 #include <vector>
25 
26 #include <tools/gen.hxx>
27 #include <vcl/vclptr.hxx>
28 
29 #include "fontinstance.hxx"
30 #include "PhysicalFontFace.hxx"
31 #include "impfontcache.hxx"
32 
33 class Size;
34 namespace vcl { class Font; }
35 class VirtualDevice;
37 enum class AddFontSubstituteFlags;
38 
39 // an ImplDeviceFontList is created by a PhysicalFontCollection
40 // it becomes invalid when original PhysicalFontCollection is modified
42 {
43 private:
44  std::vector<rtl::Reference<PhysicalFontFace>> maDevFontVector;
45 
46 public:
47  ImplDeviceFontList() { maDevFontVector.reserve(1024); }
48  void Add( PhysicalFontFace* pFace ) { maDevFontVector.push_back( pFace ); }
49  PhysicalFontFace* Get( int nIndex ) const { return maDevFontVector[ nIndex ].get(); }
50  int Count() const { return maDevFontVector.size(); }
51 };
52 
54 {
55 private:
56  std::vector<int> maSizeList;
57 
58 public:
60  { maSizeList.reserve( 32 ); }
61  void Add( int nHeight ) { maSizeList.push_back( nHeight ); }
62  int Count() const { return maSizeList.size(); }
63  int Get( int nIndex ) const { return maSizeList[ nIndex ]; }
64 };
65 
66 // nowadays these substitutions are needed for backward compatibility and tight platform integration:
67 // - substitutions from configuration entries (Tools->Options->FontReplacement and/or fontconfig)
68 // - device specific substitutions (e.g. for PS printer builtin fonts)
69 // - substitutions for missing fonts defined by configuration entries (generic and/or platform dependent fallbacks)
70 // - substitutions for missing fonts defined by multi-token fontnames (e.g. fontname="SpecialFont;FallbackA;FallbackB")
71 // - substitutions for incomplete fonts (implicit, generic, EUDC and/or platform dependent fallbacks)
72 // - substitutions for missing symbol fonts by translating code points into other symbol fonts
73 
75 {
76  // TODO: there is more commonality between the different substitutions
77 protected:
78  virtual ~ImplFontSubstitution() {}
79 };
80 
81 // ImplDirectFontSubstitution is for Tools->Options->FontReplacement and PsPrinter substitutions
82 // The class is just a simple port of the unmaintainable manual-linked-list based mechanism
83 // TODO: get rid of this class when the Tools->Options->FontReplacement tabpage is gone for good
84 
86 {
87  OUString maSearchName;
90 
91  ImplFontSubstEntry( const OUString& rFontName, const OUString& rSubstFontName, AddFontSubstituteFlags nSubstFlags );
92 };
93 
95 : public ImplFontSubstitution
96 {
97 private:
98  std::vector<ImplFontSubstEntry> maFontSubstList;
99 public:
100  void AddFontSubstitute( const OUString& rFontName, const OUString& rSubstName, AddFontSubstituteFlags nFlags );
101  void RemoveFontsSubstitute();
102 
103  bool FindFontSubstitute( OUString& rSubstName, const OUString& rFontName ) const;
104 };
105 
106 // PreMatchFontSubstitution
107 // abstracts the concept of a configured font substitution
108 // before the availability of the originally selected font has been checked
110 : public ImplFontSubstitution
111 {
112 public:
113  virtual bool FindFontSubstitute(FontSelectPattern&) const = 0;
114 };
115 
116 // ImplGlyphFallbackFontSubstitution
117 // abstracts the concept of finding the best font to support an incomplete font
119 : public ImplFontSubstitution
120 {
121 public:
122  virtual bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const = 0;
123 };
124 
125 namespace vcl { struct ControlLayoutData; }
126 // #i75163#
127 namespace basegfx { class B2DHomMatrix; }
128 
130 {
134 
135  // #i75163#
138 };
139 
140 void ImplFontSubstitute( OUString& rFontName );
141 
142 #endif // INCLUDED_VCL_INC_OUTDEV_H
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Add(PhysicalFontFace *pFace)
Definition: outdev.h:48
basegfx::B2DHomMatrix * mpInverseViewTransform
Definition: outdev.h:137
bool FindFontSubstitute(OUString &rSubstName, const OUString &rFontName) const
AddFontSubstituteFlags const mnFlags
Definition: outdev.h:89
OUString maSearchReplaceName
Definition: outdev.h:88
OUString maSearchName
Definition: outdev.h:87
AddFontSubstituteFlags
Definition: outdev.hxx:244
abstract base class for physical font faces
ImplFontSubstEntry(const OUString &rFontName, const OUString &rSubstFontName, AddFontSubstituteFlags nSubstFlags)
int Get(int nIndex) const
Definition: outdev.h:63
basegfx::B2DHomMatrix * mpViewTransform
Definition: outdev.h:136
PhysicalFontFace * Get(int nIndex) const
Definition: outdev.h:49
int Count() const
Definition: outdev.h:62
virtual bool FindFontSubstitute(FontSelectPattern &, LogicalFontInstance *pLogicalFont, OUString &rMissingCodes) const =0
int Count() const
Definition: outdev.h:50
VclPtr< VirtualDevice > mpRotateDev
Definition: outdev.h:131
std::vector< int > maSizeList
Definition: outdev.h:56
virtual bool FindFontSubstitute(FontSelectPattern &) const =0
void ImplFontSubstitute(OUString &rFontName)
std::vector< rtl::Reference< PhysicalFontFace > > maDevFontVector
Definition: outdev.h:44
tools::Rectangle maRecordRect
Definition: outdev.h:133
std::vector< ImplFontSubstEntry > maFontSubstList
Definition: outdev.h:98
vcl::ControlLayoutData * mpRecordLayout
Definition: outdev.h:132
void AddFontSubstitute(const OUString &rFontName, const OUString &rSubstName, AddFontSubstituteFlags nFlags)
void Add(int nHeight)
Definition: outdev.h:61
virtual ~ImplFontSubstitution()
Definition: outdev.h:78