diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java index e6fd4374da1..4b0f84fc0eb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java @@ -17,7 +17,6 @@ import java.util.*; import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; /* @@ -92,7 +91,7 @@ public class BidiUtil { * @param runnable the code that should be executed when a keyboard language change * occurs */ -public static void addLanguageListener (long hwnd, Runnable runnable) { +private static void addLanguageListener (long hwnd, Runnable runnable) { languageMap.put(new LONG(hwnd), runnable); subclass(hwnd); } @@ -113,259 +112,7 @@ static long EnumSystemLanguageGroupsProc(long lpLangGrpId, long lpLangGrpIdStrin } return 1; } -/** - * Wraps the ExtTextOut function. - * - * @param gc the gc to use for rendering - * @param renderBuffer the glyphs to render as an array of characters - * @param renderDx the width of each glyph in renderBuffer - * @param x x position to start rendering - * @param y y position to start rendering - */ -public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) { - int length = renderDx.length; - if (OS.GetLayout (gc.handle) != 0) { - reverse(renderDx); - renderDx[length-1]--; //fixes bug 40006 - reverse(renderBuffer); - } - // render transparently to avoid overlapping segments. fixes bug 40006 - int oldBkMode = OS.SetBkMode(gc.handle, OS.TRANSPARENT); - OS.ExtTextOut(gc.handle, x, y, ETO_GLYPH_INDEX , null, renderBuffer, renderBuffer.length, renderDx); - OS.SetBkMode(gc.handle, oldBkMode); -} -/** - * Return ordering and rendering information for the given text. Wraps the GetFontLanguageInfo - * and GetCharacterPlacement functions. - * - * @param gc the GC to use for measuring of this line, input parameter - * @param text text that bidi data should be calculated for, input parameter - * @param order an array of integers representing the visual position of each character in - * the text array, output parameter - * @param classBuffer an array of integers representing the type (e.g., ARABIC, HEBREW, - * LOCALNUMBER) of each character in the text array, input/output parameter - * @param dx an array of integers representing the pixel width of each glyph in the returned - * glyph buffer, output parameter - * @param flags an integer representing rendering flag information, input parameter - * @param offsets text segments that should be measured and reordered separately, input - * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details. - * @return buffer with the glyphs that should be rendered for the given text - */ -public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int [] offsets) { - int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle); - long hHeap = OS.GetProcessHeap(); - boolean isRightOriented = OS.GetLayout(gc.handle) != 0; - char [] textBuffer = text.toCharArray(); - int byteCount = textBuffer.length; - boolean linkBefore = (flags & LINKBEFORE) == LINKBEFORE; - boolean linkAfter = (flags & LINKAFTER) == LINKAFTER; - - GCP_RESULTS result = new GCP_RESULTS(); - result.lStructSize = GCP_RESULTS.sizeof; - result.nGlyphs = byteCount; - long lpOrder = result.lpOrder = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 4); - long lpDx = result.lpDx = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 4); - long lpClass = result.lpClass = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - long lpGlyphs = result.lpGlyphs = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount * 2); - - // set required dwFlags - int dwFlags = 0; - int glyphFlags = 0; - // Always reorder. We assume that if we are calling this function we're - // on a platform that supports bidi. Fixes 20690. - dwFlags |= GCP_REORDER; - if ((fontLanguageInfo & GCP_LIGATE) == GCP_LIGATE) { - dwFlags |= GCP_LIGATE; - glyphFlags |= 0; - } - if ((fontLanguageInfo & GCP_GLYPHSHAPE) == GCP_GLYPHSHAPE) { - dwFlags |= GCP_GLYPHSHAPE; - if (linkBefore) { - glyphFlags |= GCPGLYPH_LINKBEFORE; - } - if (linkAfter) { - glyphFlags |= GCPGLYPH_LINKAFTER; - } - } - byte[] lpGlyphs2; - if (linkBefore || linkAfter) { - lpGlyphs2 = new byte[2]; - lpGlyphs2[0]=(byte)glyphFlags; - lpGlyphs2[1]=(byte)(glyphFlags >> 8); - } - else { - lpGlyphs2 = new byte[] {(byte) glyphFlags}; - } - OS.MoveMemory(result.lpGlyphs, lpGlyphs2, lpGlyphs2.length); - - if ((flags & CLASSIN) == CLASSIN) { - // set classification values for the substring - dwFlags |= GCP_CLASSIN; - OS.MoveMemory(result.lpClass, classBuffer, classBuffer.length); - } - - char[] glyphBuffer = new char[result.nGlyphs]; - int glyphCount = 0; - for (int i=0; i