Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/font/fontsubstitution.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
// nowadays these substitutions are needed for backward compatibility and tight platform integration:
21
// - substitutions from configuration entries (Tools->Options->FontReplacement and/or fontconfig)
22
// - device specific substitutions (e.g. for PS printer builtin fonts)
23
// - substitutions for missing fonts defined by configuration entries (generic and/or platform dependent fallbacks)
24
// - substitutions for missing fonts defined by multi-token fontnames (e.g. fontname="SpecialFont;FallbackA;FallbackB")
25
// - substitutions for incomplete fonts (implicit, generic, EUDC and/or platform dependent fallbacks)
26
// - substitutions for missing symbol fonts by translating code points into other symbol fonts
27
28
#pragma once
29
30
#include <sal/config.h>
31
32
#include <rtl/ustring.hxx>
33
34
#include <font/FontSelectPattern.hxx>
35
36
class LogicalFontInstance;
37
38
namespace vcl::font
39
{
40
class FontSelectPattern;
41
42
class FontSubstitution
43
{
44
    // TODO: there is more commonality between the different substitutions
45
protected:
46
46
    virtual ~FontSubstitution() {}
47
};
48
49
/// Abstracts the concept of finding the best font to support an incomplete font
50
class GlyphFallbackFontSubstitution : public FontSubstitution
51
{
52
public:
53
    virtual bool FindFontSubstitute(vcl::font::FontSelectPattern&,
54
                                    LogicalFontInstance* pLogicalFont,
55
                                    OUString& rMissingCodes) const = 0;
56
};
57
58
/** Abstracts the concept of a configured font substitution before the
59
    availability of the originally selected font has been checked.
60
 */
61
class PreMatchFontSubstitution : public FontSubstitution
62
{
63
public:
64
    virtual bool FindFontSubstitute(vcl::font::FontSelectPattern&) const = 0;
65
};
66
67
void ImplFontSubstitute(OUString& rFontName);
68
}
69
70
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */