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 | |
parent | 7154b092a716d4d0041a8a563294511ec9e5dbc6 (diff) |
cosmetic: split PhysicalFontFamily/Collection out of outdev3.cxx
Change-Id: Iae8eb15413c0c069c14edd92c94ecb0113d9d371
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/PhysicalFontCollection.hxx | 90 | ||||
-rw-r--r-- | vcl/inc/PhysicalFontFamily.hxx | 84 | ||||
-rw-r--r-- | vcl/inc/generic/genpspgraphics.h | 1 | ||||
-rw-r--r-- | vcl/inc/generic/glyphcache.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/magic.h | 23 | ||||
-rw-r--r-- | vcl/inc/outdev.h | 56 | ||||
-rw-r--r-- | vcl/inc/outfont.hxx | 65 | ||||
-rw-r--r-- | vcl/inc/sallayout.hxx | 15 | ||||
-rw-r--r-- | vcl/inc/unx/salgdi.h | 1 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 1 |
10 files changed, 213 insertions, 124 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: */ diff --git a/vcl/inc/PhysicalFontFamily.hxx b/vcl/inc/PhysicalFontFamily.hxx new file mode 100644 index 000000000000..b1f56dece2db --- /dev/null +++ b/vcl/inc/PhysicalFontFamily.hxx @@ -0,0 +1,84 @@ +/* -*- 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 <set> + +#include <unotools/fontcfg.hxx> + +#include "PhysicalFontFace.hxx" +#include "PhysicalFontFamily.hxx" + +class PhysicalFontFace; +class PhysicalFontCollection; + +// flags for mnMatchType member +#define FONT_FAMILY_SCALABLE (1<<0) +#define FONT_FAMILY_SYMBOL (1<<1) +#define FONT_FAMILY_NONESYMBOL (1<<2) +#define FONT_FAMILY_LIGHT (1<<4) +#define FONT_FAMILY_BOLD (1<<5) +#define FONT_FAMILY_NORMAL (1<<6) +#define FONT_FAMILY_NONEITALIC (1<<8) +#define FONT_FAMILY_ITALIC (1<<9) + +class PhysicalFontFamily +{ +public: + PhysicalFontFamily( const OUString& rSearchName ); + ~PhysicalFontFamily(); + + const OUString& GetFamilyName() const { return maName; } + const OUString& GetSearchName() const { return maSearchName; } + const OUString& GetAliasNames() const { return maMapNames; } + const OUString& GetMatchFamilyName() const { return maMatchFamilyName; } + sal_uLong GetMatchType() const { return mnMatchType ; } + FontWeight GetMatchWeight() const { return meMatchWeight ; } + FontWidth GetMatchWidth() const { return meMatchWidth ; } + bool IsScalable() const { return mpFirst->IsScalable(); } + int GetMinQuality() const { return mnMinQuality; } + int GetTypeFaces() const { return mnTypeFaces; } + bool AddFontFace( PhysicalFontFace* ); + void InitMatchData( const utl::FontSubstConfiguration&, + const OUString& rSearchName ); + PhysicalFontFace* FindBestFontFace( const FontSelectPattern& rFSD ) const; + + void GetFontHeights( std::set<int>& rHeights ) const; + void UpdateDevFontList( ImplGetDevFontList& ) const; + void UpdateCloneFontList( PhysicalFontCollection&, + bool bScalable, bool bEmbeddable ) const; + +static void CalcType( sal_uLong& rType, FontWeight& rWeight, FontWidth& rWidth, + FontFamily eFamily, const utl::FontNameAttr* pFontAttr ); + +private: + PhysicalFontFace* mpFirst; // linked list of physical font faces + OUString maName; // Fontname (original font family name) + OUString maSearchName; // normalized font family name + OUString maMapNames; // fontname aliases + int mnTypeFaces; // Typeface Flags + sal_uLong mnMatchType; // MATCH - Type + OUString maMatchFamilyName; // MATCH - FamilyName + FontWeight meMatchWeight; // MATCH - Weight + FontWidth meMatchWidth; // MATCH - Width + FontFamily meFamily; + FontPitch mePitch; + int mnMinQuality; // quality of the worst font face +}; + diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index ea7d381545fc..3d1bbc7178fc 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -29,6 +29,7 @@ #include "vclpluginapi.h" class PhysicalFontFace; +class PhysicalFontCollection; namespace psp { struct JobData; class PrinterGfx; } diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx index 47188e9370c5..28770f784ab2 100644 --- a/vcl/inc/generic/glyphcache.hxx +++ b/vcl/inc/generic/glyphcache.hxx @@ -30,6 +30,7 @@ class GlyphCachePeer; class ServerFontLayoutEngine; class ServerFontLayout; class ImplFontOptions; +class PhysicalFontCollection; #include <tools/gen.hxx> #include <basebmp/bitmapdevice.hxx> diff --git a/vcl/inc/magic.h b/vcl/inc/magic.h new file mode 100644 index 000000000000..7da1d09b9b50 --- /dev/null +++ b/vcl/inc/magic.h @@ -0,0 +1,23 @@ +/* -*- 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 + +#define MAX_FALLBACK 16 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index 9baba35dc988..a8f4037a0dd5 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -24,6 +24,8 @@ #include <set> #include <vector> +#include <tools/gen.hxx> + #include "outfont.hxx" #include "PhysicalFontFace.hxx" @@ -32,56 +34,7 @@ class Font; class VirtualDevice; class ImplGetDevFontList; class GetDevSizeList; - -// flags for mnMatchType member -#define IMPL_DEVFONT_SCALABLE ((sal_uIntPtr)0x00000001) -#define IMPL_DEVFONT_SYMBOL ((sal_uIntPtr)0x00000002) -#define IMPL_DEVFONT_NONESYMBOL ((sal_uIntPtr)0x00000004) -#define IMPL_DEVFONT_LIGHT ((sal_uIntPtr)0x00000010) -#define IMPL_DEVFONT_BOLD ((sal_uIntPtr)0x00000020) -#define IMPL_DEVFONT_NORMAL ((sal_uIntPtr)0x00000040) -#define IMPL_DEVFONT_NONEITALIC ((sal_uIntPtr)0x00000100) -#define IMPL_DEVFONT_ITALIC ((sal_uIntPtr)0x00000200) - - -class PhysicalFontFamily -{ -public: - PhysicalFontFamily( const OUString& rSearchName ); - ~PhysicalFontFamily(); - - const OUString& GetFamilyName() const { return maName; } - const OUString& GetSearchName() const { return maSearchName; } - const OUString& GetAliasNames() const { return maMapNames; } - bool IsScalable() const { return mpFirst->IsScalable(); } - int GetMinQuality() const { return mnMinQuality; } - - bool AddFontFace( PhysicalFontFace* ); - void InitMatchData( const utl::FontSubstConfiguration&, - const OUString& rSearchName ); - PhysicalFontFace* FindBestFontFace( const FontSelectPattern& rFSD ) const; - - void GetFontHeights( std::set<int>& rHeights ) const; - void UpdateDevFontList( ImplGetDevFontList& ) const; - void UpdateCloneFontList( PhysicalFontCollection&, - bool bScalable, bool bEmbeddable ) const; - -private: -friend class PhysicalFontCollection; // TODO: remove soon - PhysicalFontFace* mpFirst; // linked list of physical font faces - OUString maName; // Fontname (original font family name) - OUString maSearchName; // normalized font family name - OUString maMapNames; // fontname aliases - sal_uIntPtr mnTypeFaces; // Typeface Flags - sal_uIntPtr mnMatchType; // MATCH - Type - OUString maMatchFamilyName; // MATCH - FamilyName - FontWeight meMatchWeight; // MATCH - Weight - FontWidth meMatchWidth; // MATCH - Width - FontFamily meFamily; - FontPitch mePitch; - int mnMinQuality; // quality of the worst font face -}; - +class PhysicalFontCollection; // an ImplGetDevFontList is created by an PhysicalFontCollection // it becomes invalid when original PhysicalFontCollection is modified class ImplGetDevFontList @@ -218,6 +171,9 @@ struct ImplOutDevData basegfx::B2DHomMatrix* mpInverseViewTransform; }; +void ImplFontSubstitute( OUString& rFontName ); + + #endif // INCLUDED_VCL_INC_OUTDEV_H /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 12adb7cc7837..798f2611dcdc 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -161,71 +161,6 @@ public: // TODO: change to private }; -// - 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; -}; - - // - ImplFontMetricData - diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index f3727bab61b3..57e7480369fd 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -21,28 +21,25 @@ #define INCLUDED_VCL_INC_SALLAYOUT_HXX #include <iostream> +#include <list> +#include <vector> -#include <tools/gen.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <i18nlangtag/languagetag.hxx> +#include <tools/gen.hxx> +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> // for typedef sal_UCS4 #ifndef _TOOLS_LANG_HXX typedef unsigned short LanguageType; #endif -#include <vector> -#include <list> -#include <vcl/dllapi.h> - -// for typedef sal_UCS4 -#include <vcl/vclenum.hxx> +#include "magic.h" #include "salglyphid.hxx" class SalGraphics; class PhysicalFontFace; -#define MAX_FALLBACK 16 - // Layout options #define SAL_LAYOUT_BIDI_RTL 0x0001 #define SAL_LAYOUT_BIDI_STRONG 0x0002 diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index da91204b6b2a..03e7f50662a5 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -46,6 +46,7 @@ class PspSalInfoPrinter; class ServerFont; class ImplLayoutArgs; class ServerFontLayout; +class PhysicalFontCollection; class PhysicalFontFace; namespace basegfx { diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index c649cc3cc9ab..dac4d6e6565d 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -39,6 +39,7 @@ class FontSelectPattern; class ImplWinFontEntry; class ImplFontAttrCache; +class PhysicalFontCollection; #define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) #define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) |