Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/unx/generic/print/genpspgraphics.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
#include <sal/config.h>
21
#include <sal/log.hxx>
22
23
#include <vector>
24
25
#include <sal/types.h>
26
27
#include <i18nlangtag/mslangid.hxx>
28
#include <jobdata.hxx>
29
#include <vcl/settings.hxx>
30
#include <vcl/svapp.hxx>
31
#include <vcl/sysdata.hxx>
32
#include <vcl/fontcharmap.hxx>
33
#include <config_cairo_canvas.h>
34
35
#include <fontsubset.hxx>
36
#include <unx/freetype_glyphcache.hxx>
37
#include <unx/geninst.h>
38
#include <unx/genpspgraphics.h>
39
#include <langboost.hxx>
40
#include <font/LogicalFontInstance.hxx>
41
#include <fontattributes.hxx>
42
#include <font/FontMetricData.hxx>
43
#include <font/FontSelectPattern.hxx>
44
#include <font/PhysicalFontCollection.hxx>
45
#include <font/PhysicalFontFace.hxx>
46
#include <o3tl/string_view.hxx>
47
#include <sallayout.hxx>
48
49
using namespace psp;
50
51
/*******************************************************
52
 * GenPspGraphics
53
 *******************************************************/
54
55
GenPspGraphics::GenPspGraphics()
56
0
    : m_pJobData( nullptr )
57
0
    , m_aTextRenderImpl(m_aCairoCommon)
58
0
    , m_pBackend(new SvpGraphicsBackend(m_aCairoCommon))
59
0
{
60
0
}
61
62
void GenPspGraphics::Init(psp::JobData* pJob)
63
0
{
64
0
    m_pJobData = pJob;
65
0
    SetLayout( SalLayoutFlags::NONE );
66
0
}
67
68
GenPspGraphics::~GenPspGraphics()
69
0
{
70
0
    ReleaseFonts();
71
0
}
72
73
void GenPspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY )
74
0
{
75
0
    if (m_pJobData != nullptr)
76
0
    {
77
0
        int x = m_pJobData->m_aContext.getRenderResolution();
78
79
0
        rDPIX = x;
80
0
        rDPIY = x;
81
0
    }
82
0
}
83
84
void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
85
0
{
86
0
    m_aTextRenderImpl.DrawTextLayout(rLayout, *this);
87
0
}
88
89
FontCharMapRef GenPspGraphics::GetFontCharMap() const
90
0
{
91
0
    return m_aTextRenderImpl.GetFontCharMap();
92
0
}
93
94
bool GenPspGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
95
0
{
96
0
    return m_aTextRenderImpl.GetFontCapabilities(rFontCapabilities);
97
0
}
98
99
void GenPspGraphics::SetFont(LogicalFontInstance *pFontInstance, int nFallbackLevel)
100
0
{
101
0
    m_aTextRenderImpl.SetFont(pFontInstance, nFallbackLevel);
102
0
}
103
104
void GenPspGraphics::SetTextColor( Color nColor )
105
0
{
106
0
    m_aTextRenderImpl.SetTextColor(nColor);
107
0
}
108
109
bool GenPspGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection* pFontCollection,
110
                                     const OUString& rFileURL,
111
                                     const OUString& rFontName )
112
0
{
113
0
    return m_aTextRenderImpl.AddTempDevFont(pFontCollection, rFileURL, rFontName);
114
0
}
115
116
bool GenPspGraphics::RemoveTempDevFont(const OUString& rFileURL, const OUString& rFontName)
117
0
{
118
0
    return m_aTextRenderImpl.RemoveTempDevFont(rFileURL, rFontName);
119
0
}
120
121
void GenPspGraphics::GetDevFontList( vcl::font::PhysicalFontCollection *pFontCollection )
122
0
{
123
0
    m_aTextRenderImpl.GetDevFontList(pFontCollection);
124
0
}
125
126
void GenPspGraphics::ClearDevFontCache()
127
0
{
128
0
    m_aTextRenderImpl.ClearDevFontCache();
129
0
}
130
131
void GenPspGraphics::GetFontMetric(FontMetricDataRef& rxFontMetric, int nFallbackLevel)
132
0
{
133
0
    m_aTextRenderImpl.GetFontMetric(rxFontMetric, nFallbackLevel);
134
0
}
135
136
std::unique_ptr<GenericSalLayout> GenPspGraphics::GetTextLayout(int nFallbackLevel)
137
0
{
138
0
    return m_aTextRenderImpl.GetTextLayout(nFallbackLevel);
139
0
}
140
141
namespace vcl
142
{
143
    const char* getLangBoost()
144
29
    {
145
29
        const char* pLangBoost;
146
29
        const LanguageType eLang = Application::GetSettings().GetUILanguageTag().getLanguageType();
147
29
        if (eLang == LANGUAGE_JAPANESE)
148
0
            pLangBoost = "jan";
149
29
        else if (MsLangId::isKorean(eLang))
150
0
            pLangBoost = "kor";
151
29
        else if (MsLangId::isSimplifiedChinese(eLang))
152
0
            pLangBoost = "zhs";
153
29
        else if (MsLangId::isTraditionalChinese(eLang))
154
0
            pLangBoost = "zht";
155
29
        else
156
29
            pLangBoost = nullptr;
157
29
        return pLangBoost;
158
29
    }
159
}
160
161
SystemGraphicsData GenPspGraphics::GetGraphicsData() const
162
0
{
163
0
    return SystemGraphicsData();
164
0
}
165
166
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */