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