1 /*--------------------------------------------------------------------*//*:Ignore this sentence.
2 Copyright (C) 1999, 2001 SIL International. All rights reserved.
3 
4 Distributable under the terms of either the Common Public License or the
5 GNU Lesser General Public License, as specified in the LICENSING.txt file.
6 
7 File: ITextSource.h
8 Responsibility: Sharon Correll
9 Last reviewed: Not yet.
10 
11 Description:
12 	An interface for a text source that is used by the Graphite engine.
13 -------------------------------------------------------------------------------*//*:End Ignore*/
14 #ifdef _MSC_VER
15 #pragma once
16 #endif
17 #ifndef IGRTXTSRC_INCLUDED
18 #define IGRTXTSRC_INCLUDED
19 
20 
21 #include "GrAppData.h"
22 #include "GrStructs.h"
23 #include "GrResult.h"
24 
25 namespace gr
26 {
27 
28 /*----------------------------------------------------------------------------------------------
29 	Class: ITextSource
30 	This class provides an interface for a text source for the Graphite engine.
31 ----------------------------------------------------------------------------------------------*/
32 class ITextSource
33 {
34 public:
~ITextSource()35 	virtual ~ITextSource() {};
36 	virtual UtfType utfEncodingForm() = 0;
37 	virtual size_t getLength() = 0;
38 	virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer) = 0;
39 	virtual size_t fetch(toffset ichMin, size_t cch, utf16 * prgchwBuffer) = 0;
40 	virtual size_t fetch(toffset ichMin, size_t cch, utf8  * prgchsBuffer) = 0;
41 	virtual bool getRightToLeft(toffset ich) = 0;
42 	virtual unsigned int getDirectionDepth(toffset ich) = 0;
43 	virtual float getVerticalOffset(toffset ich) = 0;
44 	virtual isocode getLanguage(toffset ich) = 0;
45 
46 	virtual std::pair<toffset, toffset> propertyRange(toffset ich) = 0;
47 	virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset) = 0;
48 	virtual bool sameSegment(toffset ich1, toffset ich2) = 0;
49 };
50 
51 
52 /*----------------------------------------------------------------------------------------------
53 	Class: IColorTextSource
54 	Defines a method to get the color informtion from the text source.
55 	It is needed for SegmentPainters that want to handle color.
56 ----------------------------------------------------------------------------------------------*/
57 class IColorTextSource : public ITextSource
58 {
59 public:
60 	virtual void getColors(toffset ich, int * pclrFore, int * pclrBack) = 0;
61 };
62 
63 } // namespace gr
64 
65 #if defined(GR_NO_NAMESPACE)
66 using namespace gr;
67 #endif
68 
69 #endif // !IGRTXTSRC_INCLUDED
70