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 DeviceCoordinate GetTextWidth() const SAL_OVERRIDE
72 : {
73 0 : return maImpl.GetTextWidth();
74 : }
75 0 : virtual DeviceCoordinate FillDXArray( DeviceCoordinate* dxa ) const SAL_OVERRIDE
76 : {
77 0 : return maImpl.FillDXArray(dxa);
78 : }
79 0 : virtual sal_Int32 GetTextBreak(DeviceCoordinate max_width, DeviceCoordinate extra, int factor) const SAL_OVERRIDE
80 : {
81 0 : return maImpl.GetTextBreak(max_width, extra, factor);
82 : }
83 0 : virtual void GetCaretPositions( int as, long* cxa ) const SAL_OVERRIDE
84 : {
85 0 : maImpl.GetCaretPositions(as, cxa);
86 0 : }
87 :
88 : // used by display layers
89 0 : virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s,
90 : long* gaa = NULL, int* cpa = NULL,
91 : const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE
92 : {
93 0 : maImpl.DrawBase() = maDrawBase;
94 0 : maImpl.DrawOffset() = maDrawOffset;
95 0 : return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa, pFallbackFonts);
96 : }
97 :
98 0 : virtual void MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE { maImpl.MoveGlyph(nStart, nNewXPos); };
99 0 : virtual void DropGlyph( int nStart ) SAL_OVERRIDE { maImpl.DropGlyph(nStart); };
100 0 : virtual void Simplify( bool bIsBase ) SAL_OVERRIDE { maImpl.Simplify(bIsBase); };
101 :
102 : virtual ~GraphiteServerFontLayout() throw();
103 :
104 : static bool IsGraphiteEnabledFont(ServerFont& rServerFont);
105 : // For use with PspGraphics
106 : const sal_Unicode* getTextPtr() const { return mpStr; };
107 : int getMinCharPos() const { return mnMinCharPos; }
108 : int getMaxCharPos() const { return mnEndCharPos; }
109 : };
110 :
111 : #endif
112 : #endif // INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|