LibreOffice Module vcl (master) 1
genpspgraphics.h
Go to the documentation of this file.
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 <vcl/vclenum.hxx>
25#include <config_cairo_canvas.h>
26
27#include <unx/fontmanager.hxx>
28#include <salgdi.hxx>
29#include <sallayout.hxx>
30
32
33namespace vcl::font
34{
35class PhysicalFontFace;
36class PhysicalFontCollection;
37}
38
39namespace psp { struct JobData; class PrinterGfx; }
40
42class FontAttributes;
43class SalInfoPrinter;
45
47{
48 std::unique_ptr<GenPspGfxBackend> m_pBackend;
49
52
54 m_pFreetypeFont[ MAX_FALLBACK ];
55public:
57 virtual ~GenPspGraphics() override;
58
59 void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx );
60
61 // helper methods
62 static const void * DoGetEmbedFontData(psp::fontID aFont, tools::Long* pDataLen);
63 static void DoFreeEmbedFontData( const void* pData, tools::Long nLen );
64
65 // helper methods for sharing with X11SalGraphics
66 static void DoGetGlyphWidths( psp::fontID aFont,
67 bool bVertical,
68 std::vector< sal_Int32 >& rWidths,
69 Ucs2UIntMap& rUnicodeEnc );
70
74
75 // override all pure virtual methods
76 virtual SalGraphicsImpl* GetImpl() const override
77 {
78 return m_pBackend.get();
79 }
80
81 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
82
83 virtual void SetTextColor( Color nColor ) override;
84 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
85 virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
86 virtual FontCharMapRef GetFontCharMap() const override;
87 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
89 // graphics must drop any cached font info
90 virtual void ClearDevFontCache() override;
92 const OUString& rFileURL,
93 const OUString& rFontName ) override;
95 std::u16string_view rFileURL,
96 const OUString& rFontName);
97
98 virtual bool CreateFontSubset( const OUString& rToFile,
100 const sal_GlyphId* pGlyphIDs,
101 const sal_uInt8* pEncoding,
102 sal_Int32* pWidths,
103 int nGlyphs,
104 FontSubsetInfo& rInfo ) override;
105 virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override;
106 virtual void FreeEmbedFontData( const void* pData, tools::Long nDataLen ) override;
108 bool bVertical,
109 std::vector< sal_Int32 >& rWidths,
110 Ucs2UIntMap& rUnicodeEnc ) override;
111 virtual std::unique_ptr<GenericSalLayout>
112 GetTextLayout(int nFallbackLevel) override;
113 virtual void DrawTextLayout( const GenericSalLayout& ) override;
114
115 virtual SystemGraphicsData GetGraphicsData() const override;
116
117#if ENABLE_CAIRO_CANVAS
118 virtual bool SupportsCairo() const override;
119 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
120 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
121 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
122 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
123#endif // ENABLE_CAIRO_CANVAS
124};
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ClearDevFontCache() override
psp::JobData * m_pJobData
static FontAttributes Info2FontAttributes(const psp::FastPrintFontInfo &)
virtual SalGraphicsImpl * GetImpl() const override
virtual FontCharMapRef GetFontCharMap() const override
virtual void SetFont(LogicalFontInstance *, int nFallbackLevel) override
static bool AddTempDevFontHelper(vcl::font::PhysicalFontCollection *pFontCollection, std::u16string_view rFileURL, const OUString &rFontName)
virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override
virtual void DrawTextLayout(const GenericSalLayout &) override
virtual void SetTextColor(Color nColor) override
virtual void GetDevFontList(vcl::font::PhysicalFontCollection *) override
virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection *, const OUString &rFileURL, const OUString &rFontName) override
static void DoFreeEmbedFontData(const void *pData, tools::Long nLen)
virtual bool CreateFontSubset(const OUString &rToFile, const vcl::font::PhysicalFontFace *, const sal_GlyphId *pGlyphIDs, const sal_uInt8 *pEncoding, sal_Int32 *pWidths, int nGlyphs, FontSubsetInfo &rInfo) override
static const void * DoGetEmbedFontData(psp::fontID aFont, tools::Long *pDataLen)
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY) override
virtual void FreeEmbedFontData(const void *pData, tools::Long nDataLen) override
psp::PrinterGfx * m_pPrinterGfx
static void AnnounceFonts(vcl::font::PhysicalFontCollection *, const psp::FastPrintFontInfo &)
std::unique_ptr< GenPspGfxBackend > m_pBackend
virtual const void * GetEmbedFontData(const vcl::font::PhysicalFontFace *, tools::Long *pDataLen) override
virtual SystemGraphicsData GetGraphicsData() const override
virtual std::unique_ptr< GenericSalLayout > GetTextLayout(int nFallbackLevel) override
virtual ~GenPspGraphics() override
void Init(psp::JobData *pJob, psp::PrinterGfx *pGfx)
static void DoGetGlyphWidths(psp::fontID aFont, bool bVertical, std::vector< sal_Int32 > &rWidths, Ucs2UIntMap &rUnicodeEnc)
virtual void GetGlyphWidths(const vcl::font::PhysicalFontFace *, bool bVertical, std::vector< sal_Int32 > &rWidths, Ucs2UIntMap &rUnicodeEnc) override
virtual void GetFontMetric(ImplFontMetricDataRef &, int nFallbackLevel) override
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
Implementation class for SalGraphics.
Definition: salgdiimpl.hxx:51
abstract base class for physical font faces
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
sal_uInt16 sal_GlyphId
Definition: glyphid.hxx:24
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: cairo.hxx:36
std::shared_ptr< cairo_surface_t > CairoSurfaceSharedPtr
Definition: cairo.hxx:34
int fontID
Definition: fontmanager.hxx:55
long Long
A PhysicalFontFaceCollection is created by a PhysicalFontCollection and becomes invalid when original...
std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap
Definition: salgdi.hxx:66
#define MAX_FALLBACK
Definition: sallayout.hxx:46
unsigned char sal_uInt8