Skip to content

WIP #3099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

WIP #3099

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.jface.text/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jface.text
Bundle-Version: 3.28.100.qualifier
Bundle-Version: 3.28.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.internal.DPIUtil;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

Expand Down Expand Up @@ -82,6 +83,15 @@ public static int computeLineHeight(StyledText textWidget, int startLine, int en
return getLinePixel(textWidget, endLine) - getLinePixel(textWidget, startLine);
}

/**
* @since 3.28
*/
public static float computeLineHeightFloat(StyledText textWidget, int startLine, int endLine, int lineCount) {
int lh= computeLineHeight(textWidget, startLine, endLine, lineCount);
int zoom= DPIUtil.getZoomForAutoscaleProperty(textWidget.nativeZoom);
return DPIUtil.scaleDown((float) DPIUtil.scaleUp(lh, zoom), zoom);
}

/**
* Returns the last fully visible line of the widget. The exact semantics of "last fully visible
* line" are:
Expand Down Expand Up @@ -288,6 +298,13 @@ public static int getLinePixel(StyledText textWidget, int line) {
return textWidget.getLinePixel(line);
}

/**
* @since 3.28
*/
public static float getLinePixelFloat(StyledText textWidget, int line) {
return textWidget.getLinePixelFloat(line);
}

/*
* @see StyledText#getLineIndex(int)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ void doPaint(GC gc, ILineRange visibleLines) {
Display display= fCachedTextWidget.getDisplay();

int firstWidgetLineToDraw= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, visibleLines.getStartLine());
int y= fCachedTextWidget.getLinePixel(firstWidgetLineToDraw);
float y= fCachedTextWidget.getLinePixelFloat(firstWidgetLineToDraw);

// add empty lines if line is wrapped
boolean isWrapActive= fCachedTextWidget.getWordWrap();
Expand All @@ -856,7 +856,7 @@ void doPaint(GC gc, ILineRange visibleLines) {
continue;

final int offsetAtLine= fCachedTextWidget.getOffsetAtLine(widgetLine);
int lineHeight = JFaceTextUtil.computeLineHeight(fCachedTextWidget, widgetLine, widgetLine + 1, 1);
float lineHeight= JFaceTextUtil.computeLineHeightFloat(fCachedTextWidget, widgetLine, widgetLine + 1, 1);
paintLine(line, y, lineHeight, gc, display);

// increment y position
Expand Down Expand Up @@ -936,7 +936,7 @@ private int getBaselineBias(GC gc, int widgetLine) {
* @param display the display the drawing occurs on
* @since 3.0
*/
protected void paintLine(int line, int y, int lineheight, GC gc, Display display) {
protected void paintLine(int line, float y, float lineheight, GC gc, Display display) {
int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line);

String s= createDisplayString(line);
Expand All @@ -948,7 +948,7 @@ protected void paintLine(int line, int y, int lineheight, GC gc, Display display
int indentation= fIndentation[index];
int baselineBias= getBaselineBias(gc, widgetLine);
int verticalIndent= fCachedTextViewer.getTextWidget().getLineVerticalIndent(widgetLine);
gc.drawString(s, indentation, y + baselineBias + verticalIndent, true);
gc.drawString(s, new Point.OfFloat(indentation, y + baselineBias + verticalIndent), true);
}

/**
Expand Down
Loading