public class BidiUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CLASS_ARABIC |
static int |
CLASS_HEBREW |
static int |
CLASS_LATINNUMBER |
static int |
CLASS_LOCALNUMBER |
static int |
CLASSIN |
static int |
GLYPHSHAPE |
static int |
KEYBOARD_BIDI |
static int |
KEYBOARD_NON_BIDI |
static int |
LIGATE |
static int |
LINKAFTER |
static int |
LINKBEFORE |
static int |
REORDER |
Constructor and Description |
---|
BidiUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addLanguageListener(Control control,
java.lang.Runnable runnable) |
static void |
addLanguageListener(int hwnd,
java.lang.Runnable runnable)
Adds a language listener.
|
static void |
drawGlyphs(GC gc,
char[] renderBuffer,
int[] renderDx,
int x,
int y)
Wraps the ExtTextOut function.
|
static int |
getFontBidiAttributes(GC gc)
Return bidi attribute information for the font in the specified gc.
|
static int |
getKeyboardLanguage()
Return the active keyboard language type.
|
static void |
getOrderInfo(GC gc,
java.lang.String text,
int[] order,
byte[] classBuffer,
int flags,
int[] offsets)
Return bidi ordering information for the given text.
|
static char[] |
getRenderInfo(GC gc,
java.lang.String text,
int[] order,
byte[] classBuffer,
int[] dx,
int flags,
int[] offsets)
Return ordering and rendering information for the given text.
|
static boolean |
isBidiPlatform()
Return whether or not the platform supports a bidi language.
|
static boolean |
isKeyboardBidi()
Return whether or not the keyboard supports input of a bidi language.
|
static void |
removeLanguageListener(Control control) |
static void |
removeLanguageListener(int hwnd)
Removes the specified language listener.
|
static void |
setKeyboardLanguage(int language)
Switch the keyboard language to the specified language type.
|
static boolean |
setOrientation(Control control,
int orientation) |
static boolean |
setOrientation(int hwnd,
int orientation)
Sets the orientation (writing order) of the specified control.
|
public static final int KEYBOARD_NON_BIDI
public static final int KEYBOARD_BIDI
public static final int CLASSIN
public static final int LINKBEFORE
public static final int LINKAFTER
public static final int CLASS_HEBREW
public static final int CLASS_ARABIC
public static final int CLASS_LOCALNUMBER
public static final int CLASS_LATINNUMBER
public static final int REORDER
public static final int LIGATE
public static final int GLYPHSHAPE
public static void addLanguageListener(int hwnd, java.lang.Runnable runnable)
hwnd
- the handle of the Control that is listening for keyboard language
changesrunnable
- the code that should be executed when a keyboard language change
occurspublic static void addLanguageListener(Control control, java.lang.Runnable runnable)
public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y)
gc
- the gc to use for renderingrenderBuffer
- the glyphs to render as an array of charactersrenderDx
- the width of each glyph in renderBufferx
- x position to start renderingy
- y position to start renderingpublic static char[] getRenderInfo(GC gc, java.lang.String text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets)
gc
- the GC to use for measuring of this line, input parametertext
- text that bidi data should be calculated for, input parameterorder
- an array of integers representing the visual position of each character in
the text array, output parameterclassBuffer
- an array of integers representing the type (e.g., ARABIC, HEBREW,
LOCALNUMBER) of each character in the text array, input/output parameterdx
- an array of integers representing the pixel width of each glyph in the returned
glyph buffer, output parameterflags
- an integer representing rendering flag information, input parameteroffsets
- text segments that should be measured and reordered separately, input
parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details.public static void getOrderInfo(GC gc, java.lang.String text, int[] order, byte[] classBuffer, int flags, int[] offsets)
gc
- the GC to use for measuring of this line, input parametertext
- text that bidi data should be calculated for, input parameterorder
- an array of integers representing the visual position of each character in
the text array, output parameterclassBuffer
- an array of integers representing the type (e.g., ARABIC, HEBREW,
LOCALNUMBER) of each character in the text array, input/output parameterflags
- an integer representing rendering flag information, input parameteroffsets
- text segments that should be measured and reordered separately, input
parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details.public static int getFontBidiAttributes(GC gc)
gc
- the gc to querypublic static int getKeyboardLanguage()
public static boolean isBidiPlatform()
public static boolean isKeyboardBidi()
public static void removeLanguageListener(int hwnd)
hwnd
- the handle of the Control that is listening for keyboard language changespublic static void removeLanguageListener(Control control)
public static void setKeyboardLanguage(int language)
language
- integer representing language. One of
KEYBOARD_BIDI, KEYBOARD_NON_BIDI.public static boolean setOrientation(int hwnd, int orientation)
hwnd
- the handle of the Control to change the orientation oforientation
- one of SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHTpublic static boolean setOrientation(Control control, int orientation)