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