• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package org.apache.harmony.text;
19 
20 /**
21  * TODO: type description
22  */
23 
24 public final class BidiWrapper {
25 
26     public static final int UBIDI_DEFAULT_LTR = 0xfe;
27 
28     public static final int UBIDI_DEFAULT_RTL = 0xff;
29 
30     public static final int UBIDI_MAX_EXPLICIT_LEVEL = 61;
31 
32     public static final int UBIDI_LEVEL_OVERRIDE = 0x80;
33 
34     public static final int UBIDI_KEEP_BASE_COMBINING = 1;
35 
36     public static final int UBIDI_DO_MIRRORING = 2;
37 
38     public static final int UBIDI_INSERT_LRM_FOR_NUMERIC = 4;
39 
40     public static final int UBIDI_REMOVE_BIDI_CONTROLS = 8;
41 
42     public static final int UBIDI_OUTPUT_REVERSE = 16;
43 
44     public static final int UBiDiDirection_UBIDI_LTR = 0;
45 
46     public static final int UBiDiDirection_UBIDI_RTL = 1;
47 
48     public static final int UBiDiDirection_UBIDI_MIXED = 2;
49 
50     // Allocate a UBiDi structure.
ubidi_open()51     public static native long ubidi_open();
52 
53     // ubidi_close() must be called to free the memory associated with a
54     // UBiDi object.
ubidi_close(long pBiDi)55     public static native void ubidi_close(long pBiDi);
56 
57     // Perform the Unicode BiDi algorithm.
ubidi_setPara(long pBiDi, char[] text, int length, byte paraLevel, byte[] embeddingLevels)58     public static native void ubidi_setPara(long pBiDi, char[] text,
59             int length, byte paraLevel, byte[] embeddingLevels);
60 
61     // ubidi_setLine() sets a UBiDi to contain the reordering information,
62     // especially the resolved levels, for all the characters in a line of
63     // text.
ubidi_setLine(final long pParaBiDi, int start, int limit)64     public static native long ubidi_setLine(final long pParaBiDi, int start,
65             int limit);
66 
67     // Get the directionality of the text.
ubidi_getDirection(final long pBiDi)68     public static native int ubidi_getDirection(final long pBiDi);
69 
70     // Get the length of the text.
ubidi_getLength(final long pBiDi)71     public static native int ubidi_getLength(final long pBiDi);
72 
73     // Get the paragraph level of the text.
ubidi_getParaLevel(final long pBiDi)74     public static native byte ubidi_getParaLevel(final long pBiDi);
75 
76     // Get an array of levels for each character.
ubidi_getLevels(long pBiDi)77     public static native byte[] ubidi_getLevels(long pBiDi);
78 
79     // Get the number of runs.
ubidi_countRuns(long pBiDi)80     public static native int ubidi_countRuns(long pBiDi);
81 
82     // Get the BidiRuns
ubidi_getRuns(long pBidi)83     public static native BidiRun[] ubidi_getRuns(long pBidi);
84 
85     // This is a convenience function that does not use a UBiDi object
ubidi_reorderVisual(byte[] levels, int length)86     public static native int[] ubidi_reorderVisual(byte[] levels, int length);
87 }
88