1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX
21 #define INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX
23 #include <vcl/dllapi.h>
25 #include "outfont.hxx"
26 #include "PhysicalFontFamily.hxx"
28 // - PhysicalFontCollection -
30 // TODO: merge with ImplFontCache
31 // TODO: rename to LogicalFontManager
33 class VCL_PLUGIN_PUBLIC PhysicalFontCollection
36 friend class WinGlyphFallbackSubstititution
;
37 mutable bool mbMatchData
; // true if matching attributes are initialized
38 bool mbMapNames
; // true if MapNames are available
40 typedef std::unordered_map
<OUString
, PhysicalFontFamily
*,OUStringHash
> PhysicalFontFamilies
;
41 PhysicalFontFamilies maPhysicalFontFamilies
;
43 ImplPreMatchFontSubstitution
* mpPreMatchHook
; // device specific prematch substitution
44 ImplGlyphFallbackFontSubstitution
* mpFallbackHook
; // device specific glyh fallback substitution
47 explicit PhysicalFontCollection();
48 virtual ~PhysicalFontCollection();
50 // fill the list with device fonts
51 void Add( PhysicalFontFace
* );
53 int Count() const { return maPhysicalFontFamilies
.size(); }
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;
61 // suggest fonts for glyph fallback
62 PhysicalFontFamily
* GetGlyphFallbackFont( FontSelectPattern
&,
63 OUString
& rMissingCodes
, int nFallbackLevel
) const;
65 // prepare platform specific font substitutions
66 void SetPreMatchHook( ImplPreMatchFontSubstitution
* );
67 void SetFallbackHook( ImplGlyphFallbackFontSubstitution
* );
70 PhysicalFontCollection
* Clone( bool bScalable
, bool bEmbeddable
) const;
71 ImplGetDevFontList
* GetDevFontList() const;
72 ImplGetDevSizeList
* GetDevSizeList( const OUString
& rFontName
) const;
74 PhysicalFontFamily
* ImplFindByTokenNames(const OUString
& rTokenStr
) const;
77 void InitMatchData() const;
78 bool AreMapNamesAvailable() const { return mbMapNames
; }
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;
88 void InitGenericGlyphFallback() const;
89 mutable PhysicalFontFamily
** mpFallbackList
;
90 mutable int mnFallbackCount
;
93 #endif // INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */