1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SV_GRAPHITESERVERFONT_HXX
21 #define _SV_GRAPHITESERVERFONT_HXX
23 // We need this to enable namespace support in libgrengine headers.
27 #include <graphite_layout.hxx>
31 class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl
: public GraphiteLayout
34 GraphiteLayoutImpl(const gr_face
* pFace
,
35 ServerFont
& rServerFont
) throw()
36 : GraphiteLayout(pFace
), mrServerFont(rServerFont
) {};
37 virtual ~GraphiteLayoutImpl() throw() {};
38 virtual sal_GlyphId
getKashidaGlyph(int & width
);
40 ServerFont
& mrServerFont
;
43 // This class implments the server font specific parts.
46 class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout
: public ServerFontLayout
49 // mutable so that the DrawOffset/DrawBase can be set
50 mutable GraphiteLayoutImpl maImpl
;
51 grutils::GrFeatureParser
* mpFeatures
;
52 const sal_Unicode
* mpStr
;
54 GraphiteServerFontLayout(ServerFont
& pServerFont
) throw();
56 virtual bool LayoutText( ImplLayoutArgs
& rArgs
)
59 SalLayout::AdjustLayout(rArgs
);
60 return maImpl
.LayoutText(rArgs
);
61 }; // first step of layout
62 virtual void AdjustLayout( ImplLayoutArgs
& rArgs
)
64 SalLayout::AdjustLayout(rArgs
);
65 maImpl
.DrawBase() = maDrawBase
;
66 maImpl
.DrawOffset() = maDrawOffset
;
67 maImpl
.AdjustLayout(rArgs
);
69 virtual long GetTextWidth() const { return maImpl
.GetTextWidth(); }
70 virtual long FillDXArray( sal_Int32
* dxa
) const { return maImpl
.FillDXArray(dxa
); }
71 virtual int GetTextBreak( long mw
, long ce
, int f
) const { return maImpl
.GetTextBreak(mw
, ce
, f
); }
72 virtual void GetCaretPositions( int as
, sal_Int32
* cxa
) const { maImpl
.GetCaretPositions(as
, cxa
); }
74 // used by display layers
75 virtual int GetNextGlyphs( int l
, sal_GlyphId
* gia
, Point
& p
, int& s
,
76 sal_Int32
* gaa
= NULL
, int* cpa
= NULL
,
77 const PhysicalFontFace
** pFallbackFonts
= NULL
) const
79 maImpl
.DrawBase() = maDrawBase
;
80 maImpl
.DrawOffset() = maDrawOffset
;
81 return maImpl
.GetNextGlyphs(l
, gia
, p
, s
, gaa
, cpa
, pFallbackFonts
);
84 virtual void MoveGlyph( int nStart
, long nNewXPos
) { maImpl
.MoveGlyph(nStart
, nNewXPos
); };
85 virtual void DropGlyph( int nStart
) { maImpl
.DropGlyph(nStart
); };
86 virtual void Simplify( bool bIsBase
) { maImpl
.Simplify(bIsBase
); };
88 virtual ~GraphiteServerFontLayout() throw();
90 static bool IsGraphiteEnabledFont(ServerFont
& rServerFont
);
91 // For use with PspGraphics
92 const sal_Unicode
* getTextPtr() const { return mpStr
; };
93 int getMinCharPos() const { return mnMinCharPos
; }
94 int getMaxCharPos() const { return mnEndCharPos
; }
98 #endif //_SV_GRAPHITESERVERFONT_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */