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 : #ifndef INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
21 : #define INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
22 :
23 : // We need this to enable namespace support in libgrengine headers.
24 : #define GR_NAMESPACE
25 :
26 : #ifndef _MSC_VER
27 : #include <graphite_layout.hxx>
28 :
29 : #include "generic/glyphcache.hxx"
30 :
31 : class PhysicalFontFace;
32 :
33 : // Modules
34 :
35 : class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
36 : {
37 : public:
38 0 : GraphiteLayoutImpl(const gr_face * pFace,
39 : ServerFont & rServerFont) throw()
40 0 : : GraphiteLayout(pFace), mrServerFont(rServerFont) {};
41 0 : virtual ~GraphiteLayoutImpl() throw() {};
42 : virtual sal_GlyphId getKashidaGlyph(int & width) SAL_OVERRIDE;
43 : private:
44 : ServerFont & mrServerFont;
45 : };
46 :
47 : // This class implments the server font specific parts.
48 : // @author tse
49 :
50 : class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout
51 : {
52 : private:
53 : // mutable so that the DrawOffset/DrawBase can be set
54 : mutable GraphiteLayoutImpl maImpl;
55 : grutils::GrFeatureParser * mpFeatures;
56 : const sal_Unicode * mpStr;
57 : public:
58 : GraphiteServerFontLayout(ServerFont& pServerFont) throw();
59 :
60 0 : virtual bool LayoutText( ImplLayoutArgs& rArgs) SAL_OVERRIDE
61 : {
62 0 : mpStr = rArgs.mpStr;
63 0 : SalLayout::AdjustLayout(rArgs);
64 0 : return maImpl.LayoutText(rArgs);
65 : }; // first step of layout
66 0 : virtual void AdjustLayout( ImplLayoutArgs& rArgs) SAL_OVERRIDE
67 : {
68 0 : SalLayout::AdjustLayout(rArgs);
69 0 : maImpl.DrawBase() = maDrawBase;
70 0 : maImpl.DrawOffset() = maDrawOffset;
71 0 : maImpl.AdjustLayout(rArgs);
72 0 : };
73 0 : virtual DeviceCoordinate GetTextWidth() const SAL_OVERRIDE
74 : {
75 0 : return maImpl.GetTextWidth();
76 : }
77 0 : virtual DeviceCoordinate FillDXArray( DeviceCoordinate* dxa ) const SAL_OVERRIDE
78 : {
79 0 : return maImpl.FillDXArray(dxa);
80 : }
81 0 : virtual sal_Int32 GetTextBreak(DeviceCoordinate max_width, DeviceCoordinate extra, int factor) const SAL_OVERRIDE
82 : {
83 0 : return maImpl.GetTextBreak(max_width, extra, factor);
84 : }
85 0 : virtual void GetCaretPositions( int as, long* cxa ) const SAL_OVERRIDE
86 : {
87 0 : maImpl.GetCaretPositions(as, cxa);
88 0 : }
89 :
90 : // used by display layers
91 0 : virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s,
92 : long* gaa = NULL, int* cpa = NULL,
93 : const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE
94 : {
95 0 : maImpl.DrawBase() = maDrawBase;
96 0 : maImpl.DrawOffset() = maDrawOffset;
97 0 : return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa, pFallbackFonts);
98 : }
99 :
100 0 : virtual void MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE { maImpl.MoveGlyph(nStart, nNewXPos); };
101 0 : virtual void DropGlyph( int nStart ) SAL_OVERRIDE { maImpl.DropGlyph(nStart); };
102 0 : virtual void Simplify( bool bIsBase ) SAL_OVERRIDE { maImpl.Simplify(bIsBase); };
103 :
104 : virtual ~GraphiteServerFontLayout() throw();
105 :
106 : static bool IsGraphiteEnabledFont(ServerFont& rServerFont);
107 : // For use with PspGraphics
108 : const sal_Unicode* getTextPtr() const { return mpStr; };
109 : int getMinCharPos() const { return mnMinCharPos; }
110 : int getMaxCharPos() const { return mnEndCharPos; }
111 : };
112 :
113 : #endif
114 : #endif // INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|