LibreOffice Module vcl (master)  1
PhysicalFontFamily.hxx
Go to the documentation of this file.
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 
20 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <vcl/dllapi.h>
25 #include <vcl/outdev.hxx>
26 
27 #include <o3tl/sorted_vector.hxx>
28 
29 #include <unotools/fontcfg.hxx>
30 
31 namespace vcl::font
32 {
33 // flags for mnTypeFaces member
34 enum class FontTypeFaces
35 {
36  NONE = 0x00,
37  Scalable = 0x01,
38  Symbol = 0x02,
39  NoneSymbol = 0x04,
40  Light = 0x08,
41  Bold = 0x10,
42  Normal = 0x20,
43  NoneItalic = 0x40,
44  Italic = 0x80
45 };
46 }
47 namespace o3tl
48 {
49 template <>
50 struct typed_flags<vcl::font::FontTypeFaces> : is_typed_flags<vcl::font::FontTypeFaces, 0xff>
51 {
52 };
53 };
54 
55 namespace vcl::font
56 {
57 class FontSelectPattern;
58 class PhysicalFontCollection;
59 class PhysicalFontFace;
60 class PhysicalFontFaceCollection;
61 
63 {
64 public:
65  PhysicalFontFamily(const OUString& rSearchName);
67 
68  // Avoid implicitly defined copy constructors/assignments for the DLLPUBLIC class (they may
69  // require forward-declared classes used internally to be defined in places using this)
70  PhysicalFontFamily(const PhysicalFontFamily&) = delete;
72  PhysicalFontFamily& operator=(const PhysicalFontFamily&) = delete;
73  PhysicalFontFamily& operator=(PhysicalFontFamily&&) = delete;
74 
75  const OUString& GetFamilyName() const { return maFamilyName; }
76  const OUString& GetSearchName() const { return maSearchName; }
77  const OUString& GetAliasNames() const { return maMapNames; }
78  int GetMinQuality() const { return mnMinQuality; }
79  FontTypeFaces GetTypeFaces() const { return mnTypeFaces; }
80 
81  const OUString& GetMatchFamilyName() const { return maMatchFamilyName; }
82  ImplFontAttrs GetMatchType() const { return mnMatchType; }
83  FontWeight GetMatchWeight() const { return meMatchWeight; }
84  FontWidth GetMatchWidth() const { return meMatchWidth; }
85  void InitMatchData(const utl::FontSubstConfiguration&, const OUString& rSearchName);
86 
87  void AddFontFace(PhysicalFontFace*);
88 
89  PhysicalFontFace* FindBestFontFace(const vcl::font::FontSelectPattern& rFSD) const;
90 
91  void UpdateDevFontList(PhysicalFontFaceCollection&) const;
92  void UpdateCloneFontList(PhysicalFontCollection&) const;
93 
94  static void CalcType(ImplFontAttrs& rType, FontWeight& rWeight, FontWidth& rWidth,
95  FontFamily eFamily, const utl::FontNameAttr* pFontAttr);
96 
97 private:
98  std::vector<rtl::Reference<PhysicalFontFace>> maFontFaces;
99 
100  OUString maFamilyName; // original font family name
101  OUString maSearchName; // normalized font family name
102  OUString maMapNames; // fontname aliases
103  FontTypeFaces mnTypeFaces; // Typeface Flags
106  int mnMinQuality; // quality of the worst font face
107 
108  ImplFontAttrs mnMatchType; // MATCH - Type
109  OUString maMatchFamilyName; // MATCH - FamilyName
110  FontWeight meMatchWeight; // MATCH - Weight
111  FontWidth meMatchWidth; // MATCH - Width
112 };
113 }
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
const OUString & GetMatchFamilyName() const
const OUString & GetAliasNames() const
FontWidth
ImplFontAttrs GetMatchType() const
ImplFontAttrs
const OUString & GetSearchName() const
std::vector< rtl::Reference< PhysicalFontFace > > maFontFaces
A PhysicalFontFaceCollection is created by a PhysicalFontCollection and becomes invalid when original...
FontPitch
abstract base class for physical font faces
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
FontFamily
FontWeight
FontTypeFaces GetTypeFaces() const
const OUString & GetFamilyName() const