OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FXCRT_FX_ARB_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_ARB_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_ARB_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_ARB_H_ |
9 | 9 |
10 #include "fx_system.h" | 10 #include "fx_system.h" |
11 | 11 |
12 // Processes characters and group them into segments based on text direction. | |
12 class IFX_BidiChar | 13 class IFX_BidiChar |
13 { | 14 { |
14 public: | 15 public: |
16 enum Direction { | |
17 NEUTRAL, | |
18 LEFT, | |
19 RIGHT | |
20 }; | |
21 | |
15 static IFX_BidiChar* Create(); | 22 static IFX_BidiChar* Create(); |
16 virtual ~IFX_BidiChar() {} | 23 virtual ~IFX_BidiChar() {} |
17 | 24 |
18 virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) = 0; | 25 // Append a character and classify it as left, right, or neutral. |
19 virtual FX_BOOL AppendChar(FX_WCHAR wch) = 0; | 26 // Returns true if the character has a different direction than the |
20 virtual FX_BOOL EndChar() = 0; | 27 // existing direction to indicate there is a segment to process. |
21 virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) = 0; | 28 virtual bool AppendChar(FX_WCHAR wch) = 0; |
22 virtual void Reset() = 0; | 29 |
30 // Call this after the last character has been appended. AppendChar() | |
31 // should not be called after this. | |
Tom Sepez
2015/06/19 20:30:32
nit: "may not" or "must not".
Lei Zhang
2015/08/17 17:41:35
Done.
| |
32 // Returns if there is still a segment to process. | |
33 virtual bool EndChar() = 0; | |
Tom Sepez
2015/06/19 20:30:32
nit: it's still a mystery -- returns what?
Lei Zhang
2015/08/17 17:41:35
Done.
| |
34 | |
35 // Get information about the segment to process. | |
36 // The segment's start position and character count goes in |iStart| and | |
Tom Sepez
2015/06/19 20:30:32
nit: s/goes in/is returned in/
Lei Zhang
2015/08/17 17:41:35
Done.
| |
37 // |iCount|, respectively. Pass in null pointers if the information is not | |
38 // needed. | |
39 // Returns the segment direction. | |
40 virtual Direction GetBidiInfo(int32_t* iStart, int32_t* iCount) = 0; | |
23 }; | 41 }; |
24 | 42 |
25 #endif // CORE_INCLUDE_FXCRT_FX_ARB_H_ | 43 #endif // CORE_INCLUDE_FXCRT_FX_ARB_H_ |
OLD | NEW |