Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/fontsubset.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 <rtl/ustring.hxx>
23
#include <tools/gen.hxx>
24
#include <o3tl/typed_flags_set.hxx>
25
26
#include <vcl/dllapi.h>
27
28
// Translate units from TT to PS (standard 1/1000)
29
10.0M
inline int XUnits(int nUPEM, int n) { return (n * 1000) / nUPEM; }
30
31
enum class FontType {
32
    NO_FONT     = 0,
33
    SFNT_TTF    = 1<<1,                     ///< SFNT container with TrueType glyphs
34
    SFNT_CFF    = 1<<2,                     ///< SFNT container with CFF-container
35
    TYPE1_PFB   = 1<<3,                     ///< PSType1 Postscript Font Binary
36
    CFF_FONT    = 1<<4,                     ///< CFF-container with PSType2 glyphs
37
    ANY_SFNT    = SFNT_TTF | SFNT_CFF
38
};
39
namespace o3tl {
40
    template<> struct typed_flags<FontType> : is_typed_flags<FontType, 0x1e> {};
41
}
42
43
class VCL_DLLPUBLIC FontSubsetInfo final
44
{
45
public: // TODO: make subsetter results private and provide accessor methods instead
46
        // subsetter-provided subset details needed by e.g. Postscript or PDF
47
    OUString                m_aPSName;
48
    int                     m_nAscent = 0;                   ///< all metrics in PS font units
49
    int                     m_nDescent = 0;
50
    int                     m_nCapHeight = 0;
51
    tools::Rectangle        m_aFontBBox;
52
    FontType                m_nFontType = FontType::NO_FONT; ///< font-type of subset result
53
};
54
55
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */