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 "fontinstance.hxx"
26 #include "PhysicalFontFamily.hxx"
28 #define MAX_GLYPHFALLBACK 16
30 class ImplGlyphFallbackFontSubstitution
;
31 class ImplPreMatchFontSubstitution
;
34 // TODO: merge with ImplFontCache
35 // TODO: rename to LogicalFontManager
37 class VCL_PLUGIN_PUBLIC PhysicalFontCollection
40 explicit PhysicalFontCollection();
41 virtual ~PhysicalFontCollection();
43 // fill the list with device font faces
44 void Add( PhysicalFontFace
* );
46 int Count() const { return maPhysicalFontFamilies
.size(); }
48 // find the device font family
49 PhysicalFontFamily
* FindFontFamily( const OUString
& rFontName
) const;
50 PhysicalFontFamily
* FindOrCreateFontFamily( const OUString
&rFamilyName
);
51 PhysicalFontFamily
* FindFontFamily( FontSelectPattern
& ) const;
52 PhysicalFontFamily
* FindFontFamilyByTokenNames(const OUString
& rTokenStr
) const;
53 PhysicalFontFamily
* FindFontFamilyByAttributes(ImplFontAttrs nSearchType
, FontWeight
, FontWidth
,
54 FontItalic
, const OUString
& rSearchFamily
) const;
56 // suggest fonts for glyph fallback
57 PhysicalFontFamily
* GetGlyphFallbackFont( FontSelectPattern
&,
58 OUString
& rMissingCodes
, int nFallbackLevel
) const;
60 // prepare platform specific font substitutions
61 void SetPreMatchHook( ImplPreMatchFontSubstitution
* );
62 void SetFallbackHook( ImplGlyphFallbackFontSubstitution
* );
65 PhysicalFontCollection
* Clone( bool bEmbeddable
) const;
66 ImplDeviceFontList
* GetDeviceFontList() const;
67 ImplDeviceFontSizeList
* GetDeviceFontSizeList( const OUString
& rFontName
) const;
70 mutable bool mbMatchData
; // true if matching attributes are initialized
71 bool mbMapNames
; // true if MapNames are available
73 typedef std::unordered_map
<OUString
, PhysicalFontFamily
*,OUStringHash
> PhysicalFontFamilies
;
74 PhysicalFontFamilies maPhysicalFontFamilies
;
76 ImplPreMatchFontSubstitution
* mpPreMatchHook
; // device specific prematch substitution
77 ImplGlyphFallbackFontSubstitution
* mpFallbackHook
; // device specific glyph fallback substitution
79 mutable PhysicalFontFamily
** mpFallbackList
;
80 mutable int mnFallbackCount
;
82 void ImplInitMatchData() const;
83 void ImplInitGenericGlyphFallback() const;
85 PhysicalFontFamily
* ImplFindFontFamilyBySearchName( const OUString
& ) const;
86 PhysicalFontFamily
* ImplFindFontFamilyByAliasName ( const OUString
& rSearchName
, const OUString
& rShortName
) const;
87 PhysicalFontFamily
* ImplFindFontFamilyBySubstFontAttr( const utl::FontNameAttr
& ) const;
89 PhysicalFontFamily
* ImplFindFontFamilyOfDefaultFont() const;
93 #endif // INCLUDED_VCL_INC_PHYSICALFONTCOLLECTION_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */