Line data Source code
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/types.h>
21 :
22 : #include <string.h>
23 : #include <math.h>
24 : #include <unistd.h>
25 : #include <fcntl.h>
26 : #include <fontconfig/fontconfig.h>
27 : #include <sys/mman.h>
28 : #include <sys/stat.h>
29 : #include <sys/types.h>
30 :
31 : #include <basegfx/polygon/b2dpolypolygon.hxx>
32 : #include <i18nlangtag/mslangid.hxx>
33 : #include <osl/file.hxx>
34 : #include <osl/module.hxx>
35 : #include <rtl/tencinfo.h>
36 : #include <sal/alloca.h>
37 : #include <tools/stream.hxx>
38 : #include <vcl/settings.hxx>
39 : #include <vcl/sysdata.hxx>
40 : #include <vcl/jobdata.hxx>
41 : #include <vcl/printerinfomanager.hxx>
42 : #include <vcl/svapp.hxx>
43 : #include <vcl/metric.hxx>
44 :
45 : #include "fontmanager.hxx"
46 : #include "impfont.hxx"
47 : #include "gcach_xpeer.hxx"
48 : #include "generic/genpspgraphics.h"
49 : #include "generic/printergfx.hxx"
50 : #include "outdev.h"
51 : #include "PhysicalFontCollection.hxx"
52 : #include "PhysicalFontFace.hxx"
53 : #include "salframe.hxx"
54 : #include "unx/saldata.hxx"
55 : #include "unx/saldisp.hxx"
56 : #include "unx/salgdi.h"
57 : #include "unx/salunx.h"
58 : #include "unx/salvd.h"
59 : #include "textrender.hxx"
60 : #include "xrender_peer.hxx"
61 :
62 : // X11SalGraphics
63 :
64 : GC
65 0 : X11SalGraphics::GetFontGC()
66 : {
67 0 : Display *pDisplay = GetXDisplay();
68 :
69 0 : if( !pFontGC_ )
70 : {
71 : XGCValues values;
72 0 : values.subwindow_mode = ClipByChildren;
73 0 : values.fill_rule = EvenOddRule; // Pict import/ Gradient
74 0 : values.graphics_exposures = False;
75 0 : values.foreground = nTextPixel_;
76 : pFontGC_ = XCreateGC( pDisplay, hDrawable_,
77 : GCSubwindowMode | GCFillRule
78 : | GCGraphicsExposures | GCForeground,
79 0 : &values );
80 : }
81 0 : if( !bFontGC_ )
82 : {
83 0 : XSetForeground( pDisplay, pFontGC_, nTextPixel_ );
84 0 : SetClipRegion( pFontGC_ );
85 0 : bFontGC_ = true;
86 : }
87 :
88 0 : return pFontGC_;
89 : }
90 :
91 3 : void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
92 : {
93 3 : mxTextRenderImpl->DrawServerFontLayout(rLayout);
94 3 : }
95 :
96 0 : const FontCharMapPtr X11SalGraphics::GetFontCharMap() const
97 : {
98 0 : return mxTextRenderImpl->GetFontCharMap();
99 : }
100 :
101 0 : bool X11SalGraphics::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCapabilities) const
102 : {
103 0 : return mxTextRenderImpl->GetFontCapabilities(rGetImplFontCapabilities);
104 : }
105 :
106 : // SalGraphics
107 :
108 518 : sal_uInt16 X11SalGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
109 : {
110 518 : return mxTextRenderImpl->SetFont(pEntry, nFallbackLevel);
111 : }
112 :
113 : void
114 3 : X11SalGraphics::SetTextColor( SalColor nSalColor )
115 : {
116 3 : mxTextRenderImpl->SetTextColor(nSalColor);
117 3 : nTextPixel_ = GetPixel( nSalColor );
118 3 : bFontGC_ = false;
119 3 : }
120 :
121 0 : bool X11SalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
122 : const OUString& rFileURL,
123 : const OUString& rFontName )
124 : {
125 0 : return mxTextRenderImpl->AddTempDevFont(pFontCollection, rFileURL, rFontName);
126 : }
127 :
128 0 : void X11SalGraphics::ClearDevFontCache()
129 : {
130 0 : mxTextRenderImpl->ClearDevFontCache();
131 0 : }
132 :
133 3 : void X11SalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
134 : {
135 3 : mxTextRenderImpl->GetDevFontList(pFontCollection);
136 3 : }
137 :
138 : void
139 48 : X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric, int nFallbackLevel )
140 : {
141 48 : mxTextRenderImpl->GetFontMetric(pMetric, nFallbackLevel);
142 48 : }
143 :
144 256 : bool X11SalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
145 : {
146 256 : return mxTextRenderImpl->GetGlyphBoundRect(aGlyphId, rRect);
147 : }
148 :
149 0 : bool X11SalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
150 : ::basegfx::B2DPolyPolygon& rPolyPoly )
151 : {
152 0 : return mxTextRenderImpl->GetGlyphOutline(aGlyphId, rPolyPoly);
153 : }
154 :
155 313 : SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel )
156 : {
157 313 : return mxTextRenderImpl->GetTextLayout(rArgs, nFallbackLevel);
158 : }
159 :
160 0 : SystemFontData X11SalGraphics::GetSysFontData( int nFallbackLevel ) const
161 : {
162 0 : return mxTextRenderImpl->GetSysFontData(nFallbackLevel);
163 : }
164 :
165 0 : bool X11SalGraphics::CreateFontSubset(
166 : const OUString& rToFile,
167 : const PhysicalFontFace* pFont,
168 : const sal_GlyphId* pGlyphIds,
169 : const sal_uInt8* pEncoding,
170 : sal_Int32* pWidths,
171 : int nGlyphCount,
172 : FontSubsetInfo& rInfo
173 : )
174 : {
175 0 : return mxTextRenderImpl->CreateFontSubset(rToFile, pFont,
176 0 : pGlyphIds, pEncoding, pWidths, nGlyphCount, rInfo);
177 : }
178 :
179 0 : const void* X11SalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo, long* pDataLen )
180 : {
181 0 : return mxTextRenderImpl->GetEmbedFontData(pFont, pUnicodes, pWidths, nLen, rInfo, pDataLen);
182 : }
183 :
184 0 : void X11SalGraphics::FreeEmbedFontData( const void* pData, long nLen )
185 : {
186 0 : mxTextRenderImpl->FreeEmbedFontData(pData, nLen);
187 0 : }
188 :
189 0 : const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
190 : {
191 0 : return mxTextRenderImpl->GetFontEncodingVector(pFont, pNonEncoded, ppPriority);
192 : }
193 :
194 0 : void X11SalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
195 : bool bVertical,
196 : Int32Vector& rWidths,
197 : Ucs2UIntMap& rUnicodeEnc )
198 : {
199 0 : mxTextRenderImpl->GetGlyphWidths(pFont, bVertical, rWidths, rUnicodeEnc);
200 9 : }
201 :
202 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|