1 package net.sourceforge.phpdt.internal.ui.util;
3 import org.eclipse.swt.graphics.FontMetrics;
4 import org.eclipse.swt.graphics.GC;
5 import org.eclipse.swt.widgets.Control;
7 import org.eclipse.jface.dialogs.Dialog;
9 public class PixelConverter {
11 private FontMetrics fFontMetrics;
13 public PixelConverter(Control control) {
14 GC gc = new GC(control);
15 gc.setFont(control.getFont());
16 fFontMetrics= gc.getFontMetrics();
20 private FontMetrics fgFontMetrics;
23 * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
25 public int convertHeightInCharsToPixels(int chars) {
26 return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
30 * @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
32 public int convertHorizontalDLUsToPixels(int dlus) {
33 return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
37 * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
39 public int convertVerticalDLUsToPixels(int dlus) {
40 return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
44 * @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
46 public int convertWidthInCharsToPixels(int chars) {
47 return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);