public int charWidth(Font f, char ch) { return getFont(f).charWidth(ch); }
public int getBaselinePosition(Font f) { return getFont(f).getBaselinePosition(); }
public int stringWidth(Font f, String str) { return getFont(f).stringWidth(str); }
public int charsWidth(Font f, char[] ch, int offset, int length) { return getFont(f).charsWidth(ch, offset, length); }
public int getHeight(Font f) { return getFont(f).getHeight(); }
public void setFont(javax.microedition.lcdui.Font font) { currentFont = font; SwtFont tmpFont = (SwtFont)((SwtFontManager) DeviceFactory.getDevice().getFontManager()).getFont(currentFont); g.setFont(tmpFont.getFont()); }
public SwtDisplayGraphics(SwtGraphics a_g, MutableImage a_image) { this.g = a_g; this.image = a_image; Device device = DeviceFactory.getDevice(); this.g.setBackground(g.getColor(new RGB( ((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getRed(), ((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getGreen(), ((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getBlue()))); SwtFont tmpFont = (SwtFont) ((SwtFontManager) device.getFontManager()).getFont(currentFont); this.g.setFont(tmpFont.getFont()); if (device.getDeviceDisplay().isColor()) { this.filter = new RGBImageFilter(); } else { if (device.getDeviceDisplay().numColors() == 2) { this.filter = new BWImageFilter(); } else { this.filter = new GrayImageFilter(); } } }
if (font != null) { SwtFontManager fontManager = (SwtFontManager) device.getFontManager(); SwtFont buttonFont = (SwtFont) fontManager.getFont(font); g.setFont(buttonFont.getFont());