public class BidiUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static Callback |
callback |
(package private) static java.lang.String |
CD_PG_ARABIC |
(package private) static java.lang.String |
CD_PG_HEBREW |
static int |
CLASS_ARABIC |
static int |
CLASS_HEBREW |
static int |
CLASS_LATINNUMBER |
static int |
CLASS_LOCALNUMBER |
(package private) static java.lang.String |
CLASS_NAME |
static int |
CLASSIN |
(package private) static int |
ETO_CLIPPED |
(package private) static int |
ETO_GLYPH_INDEX |
(package private) static int |
GCP_CLASSIN |
(package private) static int |
GCP_GLYPHSHAPE |
(package private) static int |
GCP_LIGATE |
(package private) static int |
GCP_REORDER |
(package private) static byte |
GCPCLASS_ARABIC |
(package private) static byte |
GCPCLASS_HEBREW |
(package private) static byte |
GCPCLASS_LATINNUMBER |
(package private) static byte |
GCPCLASS_LOCALNUMBER |
(package private) static int |
GCPGLYPH_LINKAFTER |
(package private) static int |
GCPGLYPH_LINKBEFORE |
static int |
GLYPHSHAPE |
(package private) static int |
HKL_NEXT |
(package private) static int |
HKL_PREV |
(package private) static int |
isBidiPlatform |
static int |
KEYBOARD_BIDI |
static int |
KEYBOARD_NON_BIDI |
(package private) static java.util.Hashtable |
keyMap |
(package private) static int |
LANG_ARABIC |
(package private) static int |
LANG_FARSI |
(package private) static int |
LANG_HEBREW |
(package private) static java.util.Hashtable |
languageMap |
static int |
LIGATE |
static int |
LINKAFTER |
static int |
LINKBEFORE |
(package private) static java.util.Hashtable |
oldProcMap |
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.
|
(package private) static int |
EnumSystemLanguageGroupsProc(int lpLangGrpId,
int lpLangGrpIdString,
int lpLangGrpName,
int options,
int lParam)
Proc used for OS.EnumSystemLanguageGroups call during isBidiPlatform test.
|
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.
|
(package private) static int[] |
getKeyboardLanguageList()
Return the languages that are installed for the keyboard.
|
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.
|
(package private) static boolean |
isBidiLang(int lang) |
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.
|
(package private) static void |
reverse(char[] charArray)
Reverse the character array.
|
(package private) static void |
reverse(int[] intArray)
Reverse the integer array.
|
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.
|
(package private) static void |
subclass(int hwnd)
Override the window proc.
|
(package private) static void |
translateOrder(int[] orderArray,
int glyphCount,
boolean isRightOriented)
Adjust the order array so that it is relative to the start of the line.
|
(package private) static void |
unsubclass(int hwnd)
Remove the overridden the window proc.
|
(package private) static int |
windowProc(int hwnd,
int msg,
int wParam,
int lParam)
Window proc to intercept keyboard language switch event (WS_INPUTLANGCHANGE)
and widget orientation changes.
|
public static final int KEYBOARD_NON_BIDI
public static final int KEYBOARD_BIDI
static int isBidiPlatform
public static final int CLASSIN
public static final int LINKBEFORE
public static final int LINKAFTER
static java.util.Hashtable languageMap
static java.util.Hashtable keyMap
static java.util.Hashtable oldProcMap
static final java.lang.String CLASS_NAME
static Callback callback
static final int GCP_REORDER
static final int GCP_GLYPHSHAPE
static final int GCP_LIGATE
static final int GCP_CLASSIN
static final byte GCPCLASS_ARABIC
static final byte GCPCLASS_HEBREW
static final byte GCPCLASS_LOCALNUMBER
static final byte GCPCLASS_LATINNUMBER
static final int GCPGLYPH_LINKBEFORE
static final int GCPGLYPH_LINKAFTER
static final int ETO_CLIPPED
static final int ETO_GLYPH_INDEX
static final int LANG_ARABIC
static final int LANG_HEBREW
static final int LANG_FARSI
static final java.lang.String CD_PG_HEBREW
static final java.lang.String CD_PG_ARABIC
static final int HKL_NEXT
static final int HKL_PREV
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)
static int EnumSystemLanguageGroupsProc(int lpLangGrpId, int lpLangGrpIdString, int lpLangGrpName, int options, int lParam)
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()
static int[] getKeyboardLanguageList()
static boolean isBidiLang(int lang)
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)
static void subclass(int hwnd)
hwnd
- control to override the window proc ofstatic void reverse(char[] charArray)
charArray
- character array to reversestatic void reverse(int[] intArray)
intArray
- integer array to reversestatic void translateOrder(int[] orderArray, int glyphCount, boolean isRightOriented)
orderArray
- integer array of order values to translateglyphCount
- number of glyphs that have been processed for the current lineisRightOriented
- flag indicating whether or not current orientation is to the rightstatic void unsubclass(int hwnd)
hwnd
- control to remove the window proc override forstatic int windowProc(int hwnd, int msg, int wParam, int lParam)
hwnd
- handle of the control that is listening for the keyboard language
change eventmsg
- window message