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