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 #pragma once
21 
22 #include <set>
23 #include <vector>
24 
25 #include <tools/gen.hxx>
26 #include <vcl/vclptr.hxx>
27 
28 #include "fontinstance.hxx"
29 #include "PhysicalFontFace.hxx"
30 #include "impfontcache.hxx"
31 
32 class Size;
33 namespace vcl { class Font; }
34 class VirtualDevice;
36 enum class AddFontSubstituteFlags;
37 
39 {
40 private:
41  std::vector<int> maSizeList;
42 
43 public:
45  { maSizeList.reserve( 32 ); }
46  void Add( int nHeight ) { maSizeList.push_back( nHeight ); }
47  int Count() const { return maSizeList.size(); }
48  int Get( int nIndex ) const { return maSizeList[ nIndex ]; }
49 };
50 
51 // nowadays these substitutions are needed for backward compatibility and tight platform integration:
52 // - substitutions from configuration entries (Tools->Options->FontReplacement and/or fontconfig)
53 // - device specific substitutions (e.g. for PS printer builtin fonts)
54 // - substitutions for missing fonts defined by configuration entries (generic and/or platform dependent fallbacks)
55 // - substitutions for missing fonts defined by multi-token fontnames (e.g. fontname="SpecialFont;FallbackA;FallbackB")
56 // - substitutions for incomplete fonts (implicit, generic, EUDC and/or platform dependent fallbacks)
57 // - substitutions for missing symbol fonts by translating code points into other symbol fonts
58 
60 {
61  // TODO: there is more commonality between the different substitutions
62 protected:
63  virtual ~ImplFontSubstitution() {}
64 };
65 
66 // ImplDirectFontSubstitution is for Tools->Options->FontReplacement and PsPrinter substitutions
67 // The class is just a simple port of the unmaintainable manual-linked-list based mechanism
68 // TODO: get rid of this class when the Tools->Options->FontReplacement tabpage is gone for good
69 
71 {
72  OUString maSearchName;
75 
76  ImplFontSubstEntry( const OUString& rFontName, const OUString& rSubstFontName, AddFontSubstituteFlags nSubstFlags );
77 };
78 
80 : public ImplFontSubstitution
81 {
82 private:
83  std::vector<ImplFontSubstEntry> maFontSubstList;
84 public:
85  void AddFontSubstitute( const OUString& rFontName, const OUString& rSubstName, AddFontSubstituteFlags nFlags );
86  void RemoveFontsSubstitute();
87 
88  bool FindFontSubstitute( OUString& rSubstName, std::u16string_view rFontName ) const;
89 };
90 
91 // PreMatchFontSubstitution
92 // abstracts the concept of a configured font substitution
93 // before the availability of the originally selected font has been checked
95 : public ImplFontSubstitution
96 {
97 public:
98  virtual bool FindFontSubstitute(FontSelectPattern&) const = 0;
99 };
100 
101 // ImplGlyphFallbackFontSubstitution
102 // abstracts the concept of finding the best font to support an incomplete font
104 : public ImplFontSubstitution
105 {
106 public:
107  virtual bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const = 0;
108 };
109 
110 namespace vcl { struct ControlLayoutData; }
111 // #i75163#
112 namespace basegfx { class B2DHomMatrix; }
113 
115 {
119 
120  // #i75163#
123 };
124 
125 void ImplFontSubstitute( OUString& rFontName );
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
basegfx::B2DHomMatrix * mpInverseViewTransform
Definition: outdev.h:122
OUString maSearchReplaceName
Definition: outdev.h:73
OUString maSearchName
Definition: outdev.h:72
ImplFontSubstEntry(const OUString &rFontName, const OUString &rSubstFontName, AddFontSubstituteFlags nSubstFlags)
int Get(int nIndex) const
Definition: outdev.h:48
basegfx::B2DHomMatrix * mpViewTransform
Definition: outdev.h:121
int Count() const
Definition: outdev.h:47
virtual bool FindFontSubstitute(FontSelectPattern &, LogicalFontInstance *pLogicalFont, OUString &rMissingCodes) const =0
VclPtr< VirtualDevice > mpRotateDev
Definition: outdev.h:116
std::vector< int > maSizeList
Definition: outdev.h:41
virtual bool FindFontSubstitute(FontSelectPattern &) const =0
void ImplFontSubstitute(OUString &rFontName)
tools::Rectangle maRecordRect
Definition: outdev.h:118
std::vector< ImplFontSubstEntry > maFontSubstList
Definition: outdev.h:83
vcl::ControlLayoutData * mpRecordLayout
Definition: outdev.h:117
bool FindFontSubstitute(OUString &rSubstName, std::u16string_view rFontName) const
AddFontSubstituteFlags mnFlags
Definition: outdev.h:74
AddFontSubstituteFlags
void AddFontSubstitute(const OUString &rFontName, const OUString &rSubstName, AddFontSubstituteFlags nFlags)
void Add(int nHeight)
Definition: outdev.h:46
virtual ~ImplFontSubstitution()
Definition: outdev.h:63