1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
21 #define INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
23 #include "textrender.hxx"
24 #include <vcl/region.hxx>
27 typedef struct FT_FaceRec_
* FT_Face
;
30 class PspSalInfoPrinter
;
34 class ServerFontLayout
;
35 class PhysicalFontCollection
;
36 class PhysicalFontFace
;
37 typedef struct _cairo cairo_t
;
39 class VCL_DLLPUBLIC CairoFontsCache
45 const void *mpOptions
;
47 bool mbVerticalMetrics
;
48 bool operator ==(const CacheId
& rOther
) const
50 return maFace
== rOther
.maFace
&&
51 mpOptions
== rOther
.mpOptions
&&
52 mbEmbolden
== rOther
.mbEmbolden
&&
53 mbVerticalMetrics
== rOther
.mbVerticalMetrics
;
58 static int mnRefCount
;
59 typedef std::deque
< std::pair
<void *, CacheId
> > LRUFonts
;
60 static LRUFonts maLRUFonts
;
65 static void CacheFont(void *pFont
, const CacheId
&rId
);
66 static void* FindCachedFont(const CacheId
&rId
);
69 class VCL_DLLPUBLIC CairoTextRender
: public TextRenderImpl
71 ServerFont
* mpServerFont
[ MAX_FALLBACK
];
74 CairoFontsCache m_aCairoFontsCache
;
76 bool bDisableGraphite_
;
79 virtual GlyphCache
& getPlatformGlyphCache() = 0;
80 virtual cairo_t
* getCairoContext() = 0;
81 virtual void getSurfaceOffset(double& nDX
, double& nDY
) = 0;
82 virtual void drawSurface(cairo_t
* cr
) = 0;
84 bool setFont( const FontSelectPattern
*pEntry
, int nFallbackLevel
);
86 virtual void clipRegion(cairo_t
* cr
) = 0;
92 virtual void SetTextColor( SalColor nSalColor
) SAL_OVERRIDE
;
93 virtual sal_uInt16
SetFont( FontSelectPattern
*, int nFallbackLevel
) SAL_OVERRIDE
;
94 virtual void GetFontMetric( ImplFontMetricData
*, int nFallbackLevel
) SAL_OVERRIDE
;
95 virtual const FontCharMapPtr
GetFontCharMap() const SAL_OVERRIDE
;
96 virtual bool GetFontCapabilities(vcl::FontCapabilities
&rFontCapabilities
) const SAL_OVERRIDE
;
97 virtual void GetDevFontList( PhysicalFontCollection
* ) SAL_OVERRIDE
;
98 virtual void ClearDevFontCache() SAL_OVERRIDE
;
99 virtual bool AddTempDevFont( PhysicalFontCollection
*, const OUString
& rFileURL
, const OUString
& rFontName
) SAL_OVERRIDE
;
100 virtual bool CreateFontSubset(
101 const OUString
& rToFile
,
102 const PhysicalFontFace
*,
103 const sal_GlyphId
* pGlyphIDs
,
104 const sal_uInt8
* pEncoding
,
107 FontSubsetInfo
& rInfo
) SAL_OVERRIDE
;
109 virtual const Ucs2SIntMap
* GetFontEncodingVector( const PhysicalFontFace
*, const Ucs2OStrMap
** ppNonEncoded
, std::set
<sal_Unicode
> const**) SAL_OVERRIDE
;
110 virtual const void* GetEmbedFontData(
111 const PhysicalFontFace
*,
112 const sal_Ucs
* pUnicodes
,
115 FontSubsetInfo
& rInfo
,
116 long* pDataLen
) SAL_OVERRIDE
;
118 virtual void FreeEmbedFontData( const void* pData
, long nDataLen
) SAL_OVERRIDE
;
119 virtual void GetGlyphWidths(
120 const PhysicalFontFace
*,
122 Int32Vector
& rWidths
,
123 Ucs2UIntMap
& rUnicodeEnc
) SAL_OVERRIDE
;
125 virtual bool GetGlyphBoundRect( sal_GlyphId nIndex
, Rectangle
& ) SAL_OVERRIDE
;
126 virtual bool GetGlyphOutline( sal_GlyphId nIndex
, ::basegfx::B2DPolyPolygon
& ) SAL_OVERRIDE
;
127 virtual SalLayout
* GetTextLayout( ImplLayoutArgs
&, int nFallbackLevel
) SAL_OVERRIDE
;
128 virtual void DrawServerFontLayout( const ServerFontLayout
& ) SAL_OVERRIDE
;
129 virtual SystemFontData
GetSysFontData( int nFallbackLevel
) const SAL_OVERRIDE
;
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */