Skip to content

Commit 6e35dd8

Browse files
committed
Add GC and FontMetric interface in Linux code
1 parent a966bd1 commit 6e35dd8

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextDropTargetEffect.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void dragOver(DropTargetEvent event) {
162162
if (System.currentTimeMillis() >= scrollBeginTime) {
163163
Rectangle area = text.getClientArea();
164164
GC gc = new GC(text);
165-
FontMetrics fm = gc.getFontMetrics();
165+
IFontMetrics fm = gc.getFontMetrics();
166166
gc.dispose();
167167
double charWidth = fm.getAverageCharacterWidth();
168168
int scrollAmount = (int) (10*charWidth);

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @see GC#getFontMetrics
2424
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
2525
*/
26-
public final class FontMetrics {
26+
public final class FontMetrics implements IFontMetrics {
2727
int ascentInPoints, descentInPoints, averageCharWidthInPoints;
2828

2929
FontMetrics() {
@@ -56,6 +56,7 @@ public boolean equals (Object object) {
5656
*
5757
* @return the ascent of the font
5858
*/
59+
@Override
5960
public int getAscent() {
6061
return ascentInPoints;
6162
}
@@ -67,6 +68,7 @@ public int getAscent() {
6768
* @return the average character width of the font
6869
* @since 3.107
6970
*/
71+
@Override
7072
public double getAverageCharacterWidth() {
7173
return getAverageCharWidth();
7274
}
@@ -78,6 +80,7 @@ public double getAverageCharacterWidth() {
7880
* @return the average character width of the font
7981
* @deprecated Use getAverageCharacterWidth() instead
8082
*/
83+
@Override
8184
@Deprecated
8285
public int getAverageCharWidth() {
8386
return averageCharWidthInPoints;
@@ -91,6 +94,7 @@ public int getAverageCharWidth() {
9194
*
9295
* @return the descent of the font
9396
*/
97+
@Override
9498
public int getDescent() {
9599
return descentInPoints;
96100
}
@@ -106,6 +110,7 @@ public int getDescent() {
106110
* @see #getDescent
107111
* @see #getLeading
108112
*/
113+
@Override
109114
public int getHeight() {
110115
return ascentInPoints + descentInPoints;
111116
}
@@ -117,6 +122,7 @@ public int getHeight() {
117122
*
118123
* @return the leading space of the font
119124
*/
125+
@Override
120126
public int getLeading() {
121127
return 0; // Pango has no concept of "leading"
122128
}

0 commit comments

Comments
 (0)