summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2005-10-19 18:53:20 +0000
committerFelipe Heidrich <fheidric>2005-10-19 18:53:20 +0000
commit7c4a78e98b89e3915f90014ba34390fb70ac683c (patch)
tree45f4caea6c5afa2c300314cefaf7360e28783413
parenta60212d04ff46157f72fb87aebed81e82f528d17 (diff)
downloadeclipse.platform.swt-7c4a78e98b89e3915f90014ba34390fb70ac683c.tar.gz
eclipse.platform.swt-7c4a78e98b89e3915f90014ba34390fb70ac683c.tar.xz
eclipse.platform.swt-7c4a78e98b89e3915f90014ba34390fb70ac683c.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/textlayout/org/eclipse/swt/graphics/TextLayout.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/textlayout/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/textlayout/org/eclipse/swt/graphics/TextLayout.java
index 641f5d3a4a..f5cf5e7011 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/textlayout/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/textlayout/org/eclipse/swt/graphics/TextLayout.java
@@ -791,11 +791,16 @@ public Point getLocation (int offset, boolean trailing) {
if (trailing || offset == length) width += run.width;
} else {
if (trailing) offset++;
- String string = text.substring(run.start, offset);
- GC gc = new GC (device);
- gc.setFont(getItemFont(run));
- width += gc.stringExtent(string).x;
- gc.dispose();
+ if (run.style != null && run.style.metrics != null) {
+ GlyphMetrics metrics = run.style.metrics;
+ width += metrics.width * (offset - run.start);
+ } else {
+ String string = text.substring(run.start, offset);
+ GC gc = new GC (device);
+ gc.setFont(getItemFont(run));
+ width += gc.stringExtent(string).x;
+ gc.dispose();
+ }
}
result = new Point(width, lineY[line]);
break;
@@ -1213,7 +1218,7 @@ void place (GC gc, StyleItem run) {
GlyphMetrics metrics = run.style.metrics;
run.ascent = metrics.ascent;
run.descent = metrics.descent;
- run.width = metrics.width;
+ run.width = metrics.width * run.length;
} else {
String string = text.substring(run.start, run.start + run.length);
Point extent = gc.stringExtent(string);