Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ public static float pixelToPoint(float size, int zoom) {
return (size / scaleFactor);
}

public static double pixelToPoint(double size, int zoom) {
if (zoom == 100 || size == SWT.DEFAULT) return size;
double scaleFactor = getScalingFactorD (zoom, 100);
return (size / scaleFactor);
}


/**
* Auto-scale image with ImageData
Expand Down Expand Up @@ -194,6 +200,13 @@ public static float getScalingFactor(int zoom) {
}


public static double getScalingFactorD(int targetZoom, int currentZoom) {
if (targetZoom <= 0) {
targetZoom = deviceZoom;
}
return targetZoom / (double) currentZoom;
}

public static float getScalingFactor(int targetZoom, int currentZoom) {
if (targetZoom <= 0) {
targetZoom = deviceZoom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public int getAscent() {
* @since 3.107
*/
public double getAverageCharacterWidth() {
return getAverageCharWidth();
return DPIUtil.pixelToPoint((double)handle.tmAveCharWidth, getZoom());
}

/**
Expand Down
Loading