diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-20 00:22:26 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-20 16:11:58 -0500 |
commit | 7260bcd68726739b5fe26b4d29a1de47e7b0f5a7 (patch) | |
tree | 360f470874da345bf0723cfd90684942824df739 /vcl/inc/PhysicalFontCollection.hxx | |
parent | 7154b092a716d4d0041a8a563294511ec9e5dbc6 (diff) |
cosmetic: split PhysicalFontFamily/Collection out of outdev3.cxx
Change-Id: Iae8eb15413c0c069c14edd92c94ecb0113d9d371
Diffstat (limited to 'vcl/inc/PhysicalFontCollection.hxx')
-rw-r--r-- | vcl/inc/PhysicalFontCollection.hxx | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx new file mode 100644 index 000000000000..9c0c7a19ada2 --- /dev/null +++ b/vcl/inc/PhysicalFontCollection.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/dllapi.h> + +#include "outfont.hxx" +#include "PhysicalFontFamily.hxx" + +// - PhysicalFontCollection - + +// TODO: merge with ImplFontCache +// TODO: rename to LogicalFontManager + +class VCL_PLUGIN_PUBLIC PhysicalFontCollection +{ +private: + friend class WinGlyphFallbackSubstititution; + mutable bool mbMatchData; // true if matching attributes are initialized + bool mbMapNames; // true if MapNames are available + + typedef boost::unordered_map<const OUString, PhysicalFontFamily*,FontNameHash> PhysicalFontFamilies; + PhysicalFontFamilies maPhysicalFontFamilies; + + ImplPreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution + ImplGlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyh fallback substitution + +public: + explicit PhysicalFontCollection(); + virtual ~PhysicalFontCollection(); + + // fill the list with device fonts + void Add( PhysicalFontFace* ); + void Clear(); + int Count() const { return maPhysicalFontFamilies.size(); } + + // find the device font + PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const; + PhysicalFontFamily* ImplFindByFont( FontSelectPattern& ) const; + PhysicalFontFamily* ImplFindBySearchName( const OUString& ) const; + + // suggest fonts for glyph fallback + PhysicalFontFamily* GetGlyphFallbackFont( FontSelectPattern&, + OUString& rMissingCodes, int nFallbackLevel ) const; + + // prepare platform specific font substitutions + void SetPreMatchHook( ImplPreMatchFontSubstitution* ); + void SetFallbackHook( ImplGlyphFallbackFontSubstitution* ); + + // misc utilities + PhysicalFontCollection* Clone( bool bScalable, bool bEmbeddable ) const; + ImplGetDevFontList* GetDevFontList() const; + ImplGetDevSizeList* GetDevSizeList( const OUString& rFontName ) const; + + PhysicalFontFamily* ImplFindByTokenNames(const OUString& rTokenStr) const; + +protected: + void InitMatchData() const; + bool AreMapNamesAvailable() const { return mbMapNames; } + + PhysicalFontFamily* ImplFindByAliasName(const OUString& rSearchName, + const OUString& rShortName) const; + PhysicalFontFamily* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; + PhysicalFontFamily* ImplFindByAttributes(sal_uLong nSearchType, FontWeight, FontWidth, + FontItalic, const OUString& rSearchFamily) const; + PhysicalFontFamily* FindDefaultFont() const; + +private: + void InitGenericGlyphFallback() const; + mutable PhysicalFontFamily** mpFallbackList; + mutable int mnFallbackCount; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |