Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/font/PhysicalFontFamily.hxx
Line
Count
Source
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 <unotools/fontcfg.hxx>
28
29
namespace vcl::font
30
{
31
// flags for mnTypeFaces member
32
enum class FontTypeFaces
33
{
34
    NONE = 0x00,
35
    Scalable = 0x01,
36
    Symbol = 0x02,
37
    NoneSymbol = 0x04,
38
    Light = 0x08,
39
    Bold = 0x10,
40
    Normal = 0x20,
41
    NoneItalic = 0x40,
42
    Italic = 0x80
43
};
44
}
45
namespace o3tl
46
{
47
template <>
48
struct typed_flags<vcl::font::FontTypeFaces> : is_typed_flags<vcl::font::FontTypeFaces, 0xff>
49
{
50
};
51
};
52
53
namespace vcl::font
54
{
55
class FontSelectPattern;
56
class PhysicalFontCollection;
57
class PhysicalFontFace;
58
class PhysicalFontFaceCollection;
59
60
class VCL_PLUGIN_PUBLIC PhysicalFontFamily
61
{
62
public:
63
    PhysicalFontFamily(OUString aSearchName);
64
    ~PhysicalFontFamily();
65
66
    // Avoid implicitly defined copy constructors/assignments for the DLLPUBLIC class (they may
67
    // require forward-declared classes used internally to be defined in places using this)
68
    PhysicalFontFamily(const PhysicalFontFamily&) = delete;
69
    PhysicalFontFamily(PhysicalFontFamily&&) = delete;
70
    PhysicalFontFamily& operator=(const PhysicalFontFamily&) = delete;
71
    PhysicalFontFamily& operator=(PhysicalFontFamily&&) = delete;
72
73
3.00M
    const OUString& GetFamilyName() const { return maFamilyName; }
74
9.05M
    const OUString& GetSearchName() const { return maSearchName; }
75
0
    int GetMinQuality() const { return mnMinQuality; }
76
0
    FontTypeFaces GetTypeFaces() const { return mnTypeFaces; }
77
78
0
    const OUString& GetMatchFamilyName() const { return maMatchFamilyName; }
79
0
    ImplFontAttrs GetMatchType() const { return mnMatchType; }
80
0
    FontWeight GetMatchWeight() const { return meMatchWeight; }
81
0
    FontWidth GetMatchWidth() const { return meMatchWidth; }
82
    SAL_DLLPRIVATE void InitMatchData(const utl::FontSubstConfiguration&,
83
                                      const OUString& rSearchName);
84
85
    void AddFontFace(PhysicalFontFace*);
86
87
    PhysicalFontFace* FindBestFontFace(const vcl::font::FontSelectPattern& rFSD) const;
88
89
    SAL_DLLPRIVATE void UpdateDevFontList(PhysicalFontFaceCollection&) const;
90
    SAL_DLLPRIVATE void UpdateCloneFontList(PhysicalFontCollection&) const;
91
92
    SAL_DLLPRIVATE static void CalcType(ImplFontAttrs& rType, FontWeight& rWeight,
93
                                        FontWidth& rWidth, FontFamily eFamily,
94
                                        const utl::FontNameAttr* pFontAttr);
95
96
private:
97
    std::vector<rtl::Reference<PhysicalFontFace>> maFontFaces;
98
99
    OUString maFamilyName; // original font family name
100
    OUString maSearchName; // normalized font family name
101
    FontTypeFaces mnTypeFaces; // Typeface Flags
102
    FontFamily meFamily;
103
    FontPitch mePitch;
104
    int mnMinQuality; // quality of the worst font face
105
106
    ImplFontAttrs mnMatchType; // MATCH - Type
107
    OUString maMatchFamilyName; // MATCH - FamilyName
108
    FontWeight meMatchWeight; // MATCH - Weight
109
    FontWidth meMatchWidth; // MATCH - Width
110
};
111
}
112
113
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */