1 11 package org.eclipse.jdt.internal.debug.ui; 12 13 14 import org.eclipse.jface.dialogs.Dialog; 15 import org.eclipse.swt.graphics.FontMetrics; 16 import org.eclipse.swt.graphics.GC; 17 import org.eclipse.swt.widgets.Control; 18 19 public class PixelConverter { 20 21 private FontMetrics fFontMetrics; 22 23 public PixelConverter(Control control) { 24 GC gc = new GC(control); 25 gc.setFont(control.getFont()); 26 fFontMetrics= gc.getFontMetrics(); 27 gc.dispose(); 28 } 29 30 33 public int convertHorizontalDLUsToPixels(int dlus) { 34 return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus); 35 } 36 37 40 public int convertWidthInCharsToPixels(int chars) { 41 return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars); 42 } 43 } 44 | Popular Tags |