Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/vcl/inc/pdf/pdfbuildin_fonts.hxx
Line
Count
Source (jump to first uncovered line)
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 <font/PhysicalFontFace.hxx>
25
#include <font/LogicalFontInstance.hxx>
26
27
namespace vcl::pdf
28
{
29
struct BuildinFont
30
{
31
    OUString m_aName;
32
    OUString m_aStyleName;
33
    const char* m_pPSName;
34
    int const m_nAscent;
35
    int const m_nDescent;
36
    FontFamily const m_eFamily;
37
    rtl_TextEncoding const m_eCharSet;
38
    FontPitch const m_ePitch;
39
    FontWidth const m_eWidthType;
40
    FontWeight const m_eWeight;
41
    FontItalic const m_eItalic;
42
    int const m_aWidths[256];
43
    mutable FontCharMapRef m_xFontCharMap;
44
45
    OString getNameObject() const;
46
    const FontCharMapRef& GetFontCharMap() const;
47
    FontAttributes GetFontAttributes() const;
48
};
49
50
class BuildinFontInstance final : public LogicalFontInstance
51
{
52
public:
53
    BuildinFontInstance(const vcl::font::PhysicalFontFace&, const vcl::font::FontSelectPattern&);
54
55
    bool GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rPoly, bool) const override;
56
};
57
58
class BuildinFontFace final : public vcl::font::PhysicalFontFace
59
{
60
    static const BuildinFont m_aBuildinFonts[14];
61
    const BuildinFont& mrBuildin;
62
63
    rtl::Reference<LogicalFontInstance>
64
    CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const override;
65
66
public:
67
    explicit BuildinFontFace(int nId);
68
69
0
    const BuildinFont& GetBuildinFont() const { return mrBuildin; }
70
0
    sal_IntPtr GetFontId() const override { return reinterpret_cast<sal_IntPtr>(&mrBuildin); }
71
0
    FontCharMapRef GetFontCharMap() const override { return mrBuildin.GetFontCharMap(); }
72
0
    bool GetFontCapabilities(vcl::FontCapabilities&) const override { return false; }
73
74
0
    static const BuildinFont& Get(int nId) { return m_aBuildinFonts[nId]; }
75
};
76
77
} // namespace vcl::pdf
78
79
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */