focus(false); installFont(); int width= OS.TextWidth(string, data.font.fID, data.font.fSize, data.font.fFace); short[] fontInfo= new short[4]; OS.GetFontInfo(fontInfo); int height= fontInfo[0] + fontInfo[1]; unfocus(false); return new Point(width, height);
try { focus(false, null); installFont(); int width= OS.TextWidth(string, data.font.fID, data.font.fSize, data.font.fFace); short[] fontInfo= new short[4]; OS.GetFontInfo(fontInfo); return new Point(width, fontInfo[0] + fontInfo[1]); } finally { unfocus(false); }
public Point stringExtent(String string) {	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);	if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);	if (string.length () == 0) return new Point(0, getFontHeight());	/* AW	byte[] buffer = Converter.wcsToMbcs(getCodePage (), string, true);	int xmString = OS.XmStringCreate(buffer, OS.XmFONTLIST_DEFAULT_TAG);	int fontList = data.fontList;	int width = OS.XmStringWidth(fontList, xmString);	int height = OS.XmStringHeight(fontList, xmString);	OS.XmStringFree(xmString);	*/	focus(false);	installFont();	int width= OS.TextWidth(string, data.font.fID, data.font.fSize, data.font.fFace);	short[] fontInfo= new short[4];	OS.GetFontInfo(fontInfo);	// FontInfo	int height= fontInfo[0] + fontInfo[1];	unfocus(false);	return new Point(width, height);}