diff options
author | Silenio Quarti | 2005-01-26 22:02:16 +0000 |
---|---|---|
committer | Silenio Quarti | 2005-01-26 22:02:16 +0000 |
commit | 33c787a8a8fa6408a469ea6821b3fb685f60c9ff (patch) | |
tree | 59d07fcfbb338ad30ecd0de04eac2340f6e4ce9f | |
parent | 0bd5c650dccd2aa5916241c1e3975a1df5a879d1 (diff) | |
download | eclipse.platform.swt-33c787a8a8fa6408a469ea6821b3fb685f60c9ff.tar.gz eclipse.platform.swt-33c787a8a8fa6408a469ea6821b3fb685f60c9ff.tar.xz eclipse.platform.swt-33c787a8a8fa6408a469ea6821b3fb685f60c9ff.zip |
59514
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java | 30 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java | 16 |
2 files changed, 44 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java index f964982306..fb81c4afee 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/TextLayout.java @@ -50,6 +50,14 @@ public final class TextLayout { if (style != null) { font = style.font; foreground = style.foreground; + if (style.underline) { + length += 1; + ptrLength += 1; + } + if (style.strikeout) { + length += 1; + ptrLength += 1; + } } if (font == null) font = defaultFont; boolean synthesize = false; @@ -61,13 +69,14 @@ public final class TextLayout { synthesize = font.style != realStyle[0]; if (synthesize) { length += 2; - ptrLength += 8; + ptrLength += 2; } } if (foreground != null) { length += 1; ptrLength += RGBColor.sizeof; } + byte[] buffer1 = new byte[1]; int[] tags = new int[length]; int[] sizes = new int[length]; int[] values = new int[length]; @@ -90,7 +99,6 @@ public final class TextLayout { index++; if (synthesize) { - byte[] buffer1 = new byte[1]; buffer1[0] = (font.style & OS.italic) != 0 ? (byte)1 : 0; tags[index] = OS.kATSUQDItalicTag; sizes[index] = 1; @@ -108,6 +116,24 @@ public final class TextLayout { index++; } } + if (style != null && style.underline) { + buffer1[0] = (byte)1; + tags[index] = OS.kATSUQDUnderlineTag; + sizes[index] = 1; + values[index] = ptr1; + OS.memcpy(values[index], buffer1, sizes[index]); + ptr1 += sizes[index]; + index++; + } + if (style != null && style.strikeout) { + buffer1[0] = (byte)1; + tags[index] = OS.kATSUStyleStrikeThroughTag; + sizes[index] = 1; + values[index] = ptr1; + OS.memcpy(values[index], buffer1, sizes[index]); + ptr1 += sizes[index]; + index++; + } if (foreground != null) { RGBColor rgb = new RGBColor (); float[] color = foreground.handle; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java index 9096269c26..563f9b0c18 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java @@ -171,6 +171,22 @@ void computeRuns () { OS.memmove (attr, attribute, PangoAttribute.sizeof); OS.pango_attr_list_insert(attrList, attr); } + if (style.underline) { + int /*long*/ attr = OS.pango_attr_underline_new(OS.PANGO_UNDERLINE_SINGLE); + OS.memmove(attribute, attr, PangoAttribute.sizeof); + attribute.start_index = byteStart; + attribute.end_index = byteEnd; + OS.memmove(attr, attribute, PangoAttribute.sizeof); + OS.pango_attr_list_insert(attrList, attr); + } + if (style.strikeout) { + int /*long*/ attr = OS.pango_attr_strikethrough_new(true); + OS.memmove(attribute, attr, PangoAttribute.sizeof); + attribute.start_index = byteStart; + attribute.end_index = byteEnd; + OS.memmove(attr, attribute, PangoAttribute.sizeof); + OS.pango_attr_list_insert(attrList, attr); + } Color foreground = style.foreground; if (foreground != null && !foreground.isDisposed()) { GdkColor fg = foreground.handle; |