Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 270216 Details for
Bug 522342
[HiDPI] Vertical ruler in GEF does not support HiDPI displays
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch that uses native rotation for drawing text in vertical rulers
gef-vertical-ruler-hidpi.patch (text/plain), 3.03 KB, created by
Peter Severin
on 2017-09-15 03:12:50 EDT
(
hide
)
Description:
Patch that uses native rotation for drawing text in vertical rulers
Filename:
MIME Type:
Creator:
Peter Severin
Created:
2017-09-15 03:12:50 EDT
Size:
3.03 KB
patch
obsolete
>diff --git a/org.eclipse.gef/src/org/eclipse/gef/internal/ui/rulers/RulerFigure.java b/org.eclipse.gef/src/org/eclipse/gef/internal/ui/rulers/RulerFigure.java >index 181fd8f..3014472 100644 >--- a/org.eclipse.gef/src/org/eclipse/gef/internal/ui/rulers/RulerFigure.java >+++ b/org.eclipse.gef/src/org/eclipse/gef/internal/ui/rulers/RulerFigure.java >@@ -10,14 +10,13 @@ > *******************************************************************************/ > package org.eclipse.gef.internal.ui.rulers; > >-import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.widgets.Display; > > import org.eclipse.draw2d.ColorConstants; > import org.eclipse.draw2d.Figure; > import org.eclipse.draw2d.FigureUtilities; > import org.eclipse.draw2d.Graphics; >-import org.eclipse.draw2d.ImageUtilities; > import org.eclipse.draw2d.geometry.Dimension; > import org.eclipse.draw2d.geometry.Point; > import org.eclipse.draw2d.geometry.Rectangle; >@@ -295,6 +294,9 @@ > int endMark = (int) (((clippedBounds.y + clippedBounds.height) / dotsPerDivision)) + 1; > int leading = FigureUtilities.getFontMetrics(getFont()).getLeading(); > Rectangle forbiddenZone = new Rectangle(); >+ // Antialias is required for vertical text on Windows >+ graphics.setAntialias(SWT.ON); >+ graphics.setTextAntialias(SWT.ON); > for (int div = startMark; div <= endMark; div++) { > // y is the vertical position of the mark > int y = (int) (div * dotsPerDivision); >@@ -324,20 +326,29 @@ > // + clippedBounds.width); > graphics.drawText(num, textLocation); > } else { >- Image numImage = ImageUtilities.createRotatedImageOfString( >- num, getFont(), getForegroundColor(), >- getBackgroundColor()); >+ Dimension numSize = FigureUtilities.getStringExtents(num, >+ getFont()); >+ /* >+ * If the width is even, we want to increase it by 1. This >+ * will ensure that when marks are erased because they are >+ * too close to the number, they are erased from both sides >+ * of that number. >+ */ >+ if (numSize.width % 2 == 0) >+ numSize.width++; > Point textLocation = new Point( >- clippedBounds.x + textMargin, y >- - (numImage.getBounds().height / 2)); >- forbiddenZone.setLocation(textLocation); >- forbiddenZone.setSize(numImage.getBounds().width, >- numImage.getBounds().height); >- forbiddenZone.expand(1, >- 1 + (numImage.getBounds().height % 2 == 0 ? 1 : 0)); >+ clippedBounds.x + textMargin - leading, >+ y - (numSize.width / 2)); >+ forbiddenZone.setLocation(0, 0); >+ forbiddenZone.setSize(numSize); >+ forbiddenZone.expand(1, 1); >+ graphics.pushState(); >+ graphics.translate(textLocation); >+ graphics.rotate(-90); >+ graphics.translate(-numSize.width, 0); > graphics.fillRectangle(forbiddenZone); >- graphics.drawImage(numImage, textLocation); >- numImage.dispose(); >+ graphics.drawText(num, 0, 0); >+ graphics.popState(); > } > } else if ((div % divsPerMajorMark) % mediumMarkerDivNum == 0) { > // this is a medium mark, so its length should be longer than
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 522342
:
270215
| 270216 |
270217
|
270247
|
270281
|
270932