Line data Source code
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_PHYSICALFONTCOLLECTION_HXX
21 : #define INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX
22 :
23 : #include <vcl/dllapi.h>
24 :
25 : #include "outfont.hxx"
26 : #include "PhysicalFontFamily.hxx"
27 :
28 : // - PhysicalFontCollection -
29 :
30 : // TODO: merge with ImplFontCache
31 : // TODO: rename to LogicalFontManager
32 :
33 : class VCL_PLUGIN_PUBLIC PhysicalFontCollection
34 : {
35 : private:
36 : friend class WinGlyphFallbackSubstititution;
37 : mutable bool mbMatchData; // true if matching attributes are initialized
38 : bool mbMapNames; // true if MapNames are available
39 :
40 : typedef std::unordered_map<OUString, PhysicalFontFamily*,OUStringHash> PhysicalFontFamilies;
41 : PhysicalFontFamilies maPhysicalFontFamilies;
42 :
43 : ImplPreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution
44 : ImplGlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyh fallback substitution
45 :
46 : public:
47 : explicit PhysicalFontCollection();
48 : virtual ~PhysicalFontCollection();
49 :
50 : // fill the list with device fonts
51 : void Add( PhysicalFontFace* );
52 : void Clear();
53 2751294 : int Count() const { return maPhysicalFontFamilies.size(); }
54 :
55 : // find the device font
56 : PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const;
57 : PhysicalFontFamily* FindOrCreateFamily( const OUString &rFamilyName );
58 : PhysicalFontFamily* ImplFindByFont( FontSelectPattern& ) const;
59 : PhysicalFontFamily* ImplFindBySearchName( const OUString& ) const;
60 :
61 : // suggest fonts for glyph fallback
62 : PhysicalFontFamily* GetGlyphFallbackFont( FontSelectPattern&,
63 : OUString& rMissingCodes, int nFallbackLevel ) const;
64 :
65 : // prepare platform specific font substitutions
66 : void SetPreMatchHook( ImplPreMatchFontSubstitution* );
67 : void SetFallbackHook( ImplGlyphFallbackFontSubstitution* );
68 :
69 : // misc utilities
70 : PhysicalFontCollection* Clone( bool bScalable, bool bEmbeddable ) const;
71 : ImplGetDevFontList* GetDevFontList() const;
72 : ImplGetDevSizeList* GetDevSizeList( const OUString& rFontName ) const;
73 :
74 : PhysicalFontFamily* ImplFindByTokenNames(const OUString& rTokenStr) const;
75 :
76 : protected:
77 : void InitMatchData() const;
78 : bool AreMapNamesAvailable() const { return mbMapNames; }
79 :
80 : PhysicalFontFamily* ImplFindByAliasName(const OUString& rSearchName,
81 : const OUString& rShortName) const;
82 : PhysicalFontFamily* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const;
83 : PhysicalFontFamily* ImplFindByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth,
84 : FontItalic, const OUString& rSearchFamily) const;
85 : PhysicalFontFamily* FindDefaultFont() const;
86 :
87 : private:
88 : void InitGenericGlyphFallback() const;
89 : mutable PhysicalFontFamily** mpFallbackList;
90 : mutable int mnFallbackCount;
91 : };
92 :
93 : #endif // INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|