void (float fontSize, @Nullable Point zoomCenter) { int oldFontSize = myScheme.getEditorFontSize(); float oldFontSize2D = myScheme.getEditorFontSize2D(); Rectangle visibleArea = myScrollingModel.getVisibleArea(); Point zoomCenterRelative = zoomCenter == null ? new Point() : zoomCenter; Point zoomCenterAbsolute = new Point(visibleArea.x + zoomCenterRelative.x, visibleArea.y + zoomCenterRelative.y); LogicalPosition zoomCenterLogical = xyToLogicalPosition(zoomCenterAbsolute); int oldLineHeight = getLineHeight(); int intraLineOffset = zoomCenterAbsolute.y % oldLineHeight; myScheme.setEditorFontSize(fontSize); int newFontSize = myScheme.getEditorFontSize(); float newFontSize2D = myScheme.getEditorFontSize2D(); // the resulting font size might be different due to applied min/max limits myPropertyChangeSupport.firePropertyChange(PROP_FONT_SIZE, oldFontSize, newFontSize); myPropertyChangeSupport.firePropertyChange(PROP_FONT_SIZE_2D, oldFontSize2D, newFontSize2D); // Update vertical scroll bar bounds if necessary (we had a problem that use increased editor font size, and it was not possible // to scroll to the bottom of the document). myScrollPane.getViewport().invalidate(); Point shiftedZoomCenterAbsolute = logicalPositionToXY(zoomCenterLogical); myScrollingModel.disableAnimation(); try { int targetX = visibleArea.x == 0 ? 0 : shiftedZoomCenterAbsolute.x - zoomCenterRelative.x; // stick to the left border if it's visible int targetY = shiftedZoomCenterAbsolute.y - zoomCenterRelative.y + (intraLineOffset * getLineHeight() + oldLineHeight / 2) / oldLineHeight; myScrollingModel.scroll(targetX, targetY); } finally { myScrollingModel.enableAnimation(); } }