Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/fontsubset/fontsubset.cxx
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
21
#include <osl/diagnose.h>
22
#include <sal/log.hxx>
23
24
#include <fontsubset.hxx>
25
#include <sft.hxx>
26
27
FontSubsetInfo::FontSubsetInfo()
28
3.27k
    : m_nAscent( 0)
29
3.27k
    , m_nDescent( 0)
30
3.27k
    , m_nCapHeight( 0)
31
3.27k
    , m_nFontType( FontType::NO_FONT)
32
3.27k
    , m_bFilled(false)
33
3.27k
    , mpInFontBytes( nullptr)
34
3.27k
    , mnInByteLength( 0)
35
3.27k
    , meInFontType( FontType::NO_FONT)
36
3.27k
    , mnReqFontTypeMask( FontType::NO_FONT )
37
3.27k
    , mpOutFile(nullptr)
38
3.27k
    , mpReqGlyphIds(nullptr)
39
3.27k
    , mpReqEncodedIds(nullptr)
40
3.27k
    , mnReqGlyphCount(0)
41
3.27k
{
42
3.27k
}
43
44
FontSubsetInfo::~FontSubsetInfo()
45
3.27k
{
46
3.27k
}
47
48
// prepare subsetting for fonts where the input font file is mapped
49
void FontSubsetInfo::LoadFont(
50
    FontType eInFontType,
51
    const unsigned char* pInFontBytes, int nInByteLength)
52
0
{
53
0
    meInFontType = eInFontType;
54
0
    mpInFontBytes = pInFontBytes;
55
0
    mnInByteLength = nInByteLength;
56
0
}
57
58
bool FontSubsetInfo::CreateFontSubset(
59
    FontType nReqFontTypeMask,
60
    SvStream* pOutFile,
61
    const sal_GlyphId* pReqGlyphIds, const sal_uInt8* pReqEncodedIds, int nReqGlyphCount)
62
0
{
63
    // prepare request details needed by all underlying subsetters
64
0
    mnReqFontTypeMask = nReqFontTypeMask;
65
0
    mpOutFile       = pOutFile;
66
0
    mpReqGlyphIds   = pReqGlyphIds;
67
0
    mpReqEncodedIds = pReqEncodedIds;
68
0
    mnReqGlyphCount = nReqGlyphCount;
69
0
    maReqFontName = m_aPSName.toUtf8();
70
71
    // TODO: move the glyphid/encid/notdef reshuffling from the callers to here
72
73
    // dispatch to underlying subsetters
74
0
    bool bOK = false;
75
76
    // TODO: better match available input-type to possible subset-types
77
0
    switch( meInFontType) {
78
0
    case FontType::CFF_FONT:
79
0
        bOK = CreateFontSubsetFromCff();
80
0
        break;
81
0
    default:
82
0
        OSL_FAIL( "unhandled type in CreateFontSubset()");
83
0
        break;
84
0
    }
85
86
0
    return bOK;
87
0
}
88
89
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */