Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / graphite_serverfont.hxx
blob7dfde21551bc7b76848b17e1e4ffc78fbf53ec6b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
21 #define INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
23 // We need this to enable namespace support in libgrengine headers.
24 #define GR_NAMESPACE
26 #ifndef _MSC_VER
27 #include <graphite_layout.hxx>
29 #include "generic/glyphcache.hxx"
31 class PhysicalFontFace;
33 // Modules
35 class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
37 public:
38 GraphiteLayoutImpl(const gr_face * pFace,
39 ServerFont & rServerFont) throw()
40 : GraphiteLayout(pFace), mrServerFont(rServerFont) {};
41 virtual ~GraphiteLayoutImpl() throw() {};
42 virtual sal_GlyphId getKashidaGlyph(int & width) SAL_OVERRIDE;
43 private:
44 ServerFont & mrServerFont;
47 // This class implments the server font specific parts.
48 // @author tse
50 class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout
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();
60 virtual bool LayoutText( ImplLayoutArgs& rArgs) SAL_OVERRIDE
62 mpStr = rArgs.mpStr;
63 SalLayout::AdjustLayout(rArgs);
64 return maImpl.LayoutText(rArgs);
65 }; // first step of layout
66 virtual void AdjustLayout( ImplLayoutArgs& rArgs) SAL_OVERRIDE
68 SalLayout::AdjustLayout(rArgs);
69 maImpl.DrawBase() = maDrawBase;
70 maImpl.DrawOffset() = maDrawOffset;
71 maImpl.AdjustLayout(rArgs);
73 virtual DeviceCoordinate GetTextWidth() const SAL_OVERRIDE
75 return maImpl.GetTextWidth();
77 virtual DeviceCoordinate FillDXArray( DeviceCoordinate* dxa ) const SAL_OVERRIDE
79 return maImpl.FillDXArray(dxa);
81 virtual sal_Int32 GetTextBreak(DeviceCoordinate max_width, DeviceCoordinate extra, int factor) const SAL_OVERRIDE
83 return maImpl.GetTextBreak(max_width, extra, factor);
85 virtual void GetCaretPositions( int as, long* cxa ) const SAL_OVERRIDE
87 maImpl.GetCaretPositions(as, cxa);
90 // used by display layers
91 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
95 maImpl.DrawBase() = maDrawBase;
96 maImpl.DrawOffset() = maDrawOffset;
97 return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa, pFallbackFonts);
100 virtual void MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE { maImpl.MoveGlyph(nStart, nNewXPos); };
101 virtual void DropGlyph( int nStart ) SAL_OVERRIDE { maImpl.DropGlyph(nStart); };
102 virtual void Simplify( bool bIsBase ) SAL_OVERRIDE { maImpl.Simplify(bIsBase); };
104 virtual ~GraphiteServerFontLayout() throw();
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; }
113 #endif
114 #endif // INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */