diff options
author | Felipe Heidrich <fheidric> | 2006-03-10 20:12:22 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2006-03-10 20:12:22 +0000 |
commit | f1256286e0498a43b82e383228c40b73b19b7e29 (patch) | |
tree | b68d718eb393097af64b9d56dc8183f43ea9cdfb /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java | |
parent | f520a8dcf7987a68442ef89495b4518db5c9b2f5 (diff) | |
download | eclipse.platform.swt-f1256286e0498a43b82e383228c40b73b19b7e29.tar.gz eclipse.platform.swt-f1256286e0498a43b82e383228c40b73b19b7e29.tar.xz eclipse.platform.swt-f1256286e0498a43b82e383228c40b73b19b7e29.zip |
92548 & 67642 - styledtext updates the lineheight on the fly when font substitution returns a font too big
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java index 8971d747f2..f52b475bcd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java @@ -861,6 +861,38 @@ TextLayout getTextLayout(int lineIndex, int orientation, int width, int lineSpac } } if (lastOffset < length) layout.setStyle(null, lastOffset, length); + if (styledText.isFixedLineHeight()) { + int height = layout.getBounds().height; + if (height > getLineHeight()) { + FontMetrics metrics = layout.getLineMetrics(0); + ascent = metrics.getAscent() + metrics.getLeading(); + descent = metrics.getDescent(); + if (layouts != null) { + for (int i = 0; i < layouts.length; i++) { + if (layouts[i] != null && layouts[i] != layout) { + layouts[i].setAscent(ascent); + layouts[i].setDescent(descent); + } + } + } + if (styledText.verticalScrollOffset != 0) { + int topIndex = styledText.topIndex; + int topIndexY = styledText.topIndexY; + int lineHeight = getLineHeight(); + if (topIndexY >= 0) { + styledText.verticalScrollOffset = (topIndex - 1) * lineHeight + lineHeight - topIndexY; + } else { + styledText.verticalScrollOffset = topIndex * lineHeight - topIndexY; + } + } + if (styledText.isBidiCaret()) { + styledText.createCaretBitmaps(); + styledText.caretDirection = SWT.NULL; + } + styledText.setCaretLocation(); + styledText.redraw(); + } + } return layout; } int getWidth() { |