View | Details | Raw Unified | Return to bug 162932 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/draw2d/text/FlowUtilities.java (-7 / +7 lines)
Lines 25-44 Link Here
25
 * @author hudsonr
25
 * @author hudsonr
26
 * @since 2.1
26
 * @since 2.1
27
 */
27
 */
28
class FlowUtilities
28
public class FlowUtilities
29
	extends FigureUtilities
29
	extends FigureUtilities
30
{
30
{
31
31
32
interface LookAhead {
32
public interface LookAhead {
33
	int getWidth();
33
	int getWidth();
34
}
34
}
35
private static int ELLIPSIS_SIZE;
35
private static int ELLIPSIS_SIZE;
36
private static final BreakIterator INTERNAL_LINE_BREAK = BreakIterator.getLineInstance();
36
private static final BreakIterator INTERNAL_LINE_BREAK = BreakIterator.getLineInstance();
37
private static TextLayout layout;
37
private static TextLayout layout;
38
38
39
static final BreakIterator LINE_BREAK = BreakIterator.getLineInstance();
39
public static final BreakIterator LINE_BREAK = BreakIterator.getLineInstance();
40
40
41
static boolean canBreakAfter(char c) {
41
public static boolean canBreakAfter(char c) {
42
	boolean result = Character.isWhitespace(c) || c == '-';
42
	boolean result = Character.isWhitespace(c) || c == '-';
43
	if (!result && (c < 'a' || c > 'z')) {
43
	if (!result && (c < 'a' || c > 'z')) {
44
		// chinese characters and such would be caught in here
44
		// chinese characters and such would be caught in here
Lines 49-55 Link Here
49
	return result;
49
	return result;
50
}
50
}
51
51
52
private static int findFirstDelimeter(String string) {
52
protected static int findFirstDelimeter(String string) {
53
	int macNL = string.indexOf('\r');
53
	int macNL = string.indexOf('\r');
54
	int unixNL = string.indexOf('\n');
54
	int unixNL = string.indexOf('\n');
55
	
55
	
Lines 107-113 Link Here
107
 * @return an SWT TextLayout that can be used for Bidi
107
 * @return an SWT TextLayout that can be used for Bidi
108
 * @since 3.1
108
 * @since 3.1
109
 */
109
 */
110
static TextLayout getTextLayout() {
110
public static TextLayout getTextLayout() {
111
	if (layout == null)
111
	if (layout == null)
112
		layout = new TextLayout(Display.getDefault());
112
		layout = new TextLayout(Display.getDefault());
113
	layout.setOrientation(SWT.LEFT_TO_RIGHT);
113
	layout.setOrientation(SWT.LEFT_TO_RIGHT);
Lines 120-126 Link Here
120
 * @param font
120
 * @param font
121
 * @since 3.1
121
 * @since 3.1
122
 */
122
 */
123
private static void initBidi(TextFragmentBox frag, String string, Font font) {
123
protected static void initBidi(TextFragmentBox frag, String string, Font font) {
124
	if (frag.requiresBidi()) {
124
	if (frag.requiresBidi()) {
125
		TextLayout textLayout = getTextLayout();
125
		TextLayout textLayout = getTextLayout();
126
		textLayout.setFont(font);
126
		textLayout.setFont(font);
(-)src/org/eclipse/draw2d/text/LineRoot.java (-2 / +2 lines)
Lines 145-155 Link Here
145
	return this;
145
	return this;
146
}
146
}
147
147
148
int getVisibleBottom() {
148
public int getVisibleBottom() {
149
	return baseline + contentDescent;
149
	return baseline + contentDescent;
150
}
150
}
151
151
152
int getVisibleTop() {
152
public int getVisibleTop() {
153
	return baseline - contentAscent;
153
	return baseline - contentAscent;
154
}
154
}
155
155
(-)src/org/eclipse/draw2d/text/TextFlow.java (-4 / +4 lines)
Lines 74-80 Link Here
74
 * @return <code>true</code> if a line-break was found
74
 * @return <code>true</code> if a line-break was found
75
 * @since 3.1
75
 * @since 3.1
76
 */
76
 */
77
boolean addLeadingWordWidth(String text, int[] width) {
77
public boolean addLeadingWordWidth(String text, int[] width) {
78
	if (text.length() == 0)
78
	if (text.length() == 0)
79
		return false;
79
		return false;
80
	if (Character.isWhitespace(text.charAt(0)))
80
	if (Character.isWhitespace(text.charAt(0)))
Lines 174-180 Link Here
174
	return findOffset(p, trailing, closestBox, index);
174
	return findOffset(p, trailing, closestBox, index);
175
}
175
}
176
176
177
int getAscent() {
177
public int getAscent() {
178
	FontMetrics fm = FigureUtilities.getFontMetrics(getFont());
178
	FontMetrics fm = FigureUtilities.getFontMetrics(getFont());
179
	return fm.getHeight() - fm.getDescent();
179
	return fm.getHeight() - fm.getDescent();
180
}
180
}
Lines 259-265 Link Here
259
	return info;
259
	return info;
260
}
260
}
261
261
262
Point getPointInBox(TextFragmentBox box, int offset, int index, boolean trailing) {
262
protected Point getPointInBox(TextFragmentBox box, int offset, int index, boolean trailing) {
263
	offset -= box.offset;
263
	offset -= box.offset;
264
	offset = Math.min(box.length, offset);
264
	offset = Math.min(box.length, offset);
265
	Point result = new Point(0, box.getTextTop());
265
	Point result = new Point(0, box.getTextTop());
Lines 282-288 Link Here
282
	return result;
282
	return result;
283
}
283
}
284
284
285
int getDescent() {
285
public int getDescent() {
286
	return FigureUtilities.getFontMetrics(getFont()).getDescent();
286
	return FigureUtilities.getFontMetrics(getFont()).getDescent();
287
}
287
}
288
288
(-)src/org/eclipse/draw2d/text/ContentBox.java (-1 / +1 lines)
Lines 39-45 Link Here
39
/**
39
/**
40
 * @see org.eclipse.draw2d.text.FlowBox#getLineRoot()
40
 * @see org.eclipse.draw2d.text.FlowBox#getLineRoot()
41
 */
41
 */
42
LineRoot getLineRoot() {
42
public LineRoot getLineRoot() {
43
	return lineRoot;
43
	return lineRoot;
44
}
44
}
45
45
(-)src/org/eclipse/draw2d/text/ParagraphTextLayout.java (+24 lines)
Lines 204-207 Link Here
204
		fragments.remove(fragments.size() - 1);
204
		fragments.remove(fragments.size() - 1);
205
}
205
}
206
206
207
208
/**
209
 * @return the wrapping style being used.
210
 * @since 3.2
211
 */
212
public int getWrappingStyle() {
213
    return wrappingStyle;
214
}
215
216
217
/**
218
 * Sets the wrapping style. Default is WORD_WRAP_HARD. <p>
219
 * Can be the following values:<br>
220
 * 1. WORD_WRAP_HARD <br>
221
 * 2. WORD_WRAP_SOFT <br>
222
 * 3. WORD_WRAP_TRUNCATE <p>
223
 * 
224
 * @param wrappingStyle
225
 * @since 3.2
226
 */
227
public void setWrappingStyle(int wrappingStyle) {
228
    this.wrappingStyle = wrappingStyle;
229
}
230
207
}
231
}
(-)src/org/eclipse/draw2d/text/BidiChars.java (-8 / +8 lines)
Lines 14-27 Link Here
14
/**
14
/**
15
 * @since 3.1
15
 * @since 3.1
16
 */
16
 */
17
class BidiChars {
17
public class BidiChars {
18
18
19
static final char P_SEP = '\u2029';
19
public static final char P_SEP = '\u2029';
20
static final char ZWJ = '\u200d';
20
public static final char ZWJ = '\u200d';
21
static final char LRO = '\u202d';
21
public static final char LRO = '\u202d';
22
static final char RLO = '\u202e';
22
public static final char RLO = '\u202e';
23
static final char OBJ = '\ufffc';
23
public static final char OBJ = '\ufffc';
24
static final char LRE = '\u202a';
24
public static final char LRE = '\u202a';
25
static final char RLE = '\u202b';
25
public static final char RLE = '\u202b';
26
26
27
}
27
}

Return to bug 162932