Community
Participate
Working Groups
Hi, Firstly, big thanks to all you guys out there that make eclipse and SWT tick! I'm developing an RCP application based on a web browser based prototype. The RCP environment is a much better hosting environment for the application. However, although the browser widget has rather limited functionality, the only thing that really seems to be missing is the ability to control font sizes for accessibility options. This is somemthing that is impractical to be controlled from style sheets. Is there any plan to add control over font / font style / font size to the widget? If not, this is an enhancement request for such a feature. Many thanks! Andy
I'm not sure if this would become Browser api, but it should become doable once the eclipse 3.3 plan item in bug 154124 is addressed. Note to self: nsIDOMWindow->SetTextZoom .
*** Bug 177365 has been marked as a duplicate of this bug. ***
FYI here's how zooming is done with a SWT.MOZILLA style Browser (requires XULRunner >= 1.9): public class Snippet329 { static int zoom = 10; static Browser browser; public static void main(String [] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, true)); try { browser = new Browser(shell, SWT.MOZILLA); } catch (SWTError e) { System.out.println("Could not instantiate Browser: " + e.getMessage()); display.dispose(); return; } GridData data = new GridData(); data.heightHint = data.widthHint = 400; data.horizontalSpan = 2; browser.setLayoutData(data); Button zoomIn = new Button(shell, SWT.PUSH); zoomIn.setText("Zoom In"); zoomIn.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { setZoom(++zoom); } }); Button zoomOut = new Button(shell, SWT.PUSH); zoomOut.setText("Zoom Out"); zoomOut.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (zoom > 1) { setZoom(--zoom); } } }); shell.pack(); shell.open(); browser.setUrl("http://www.eclipse.org"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } static void setZoom(int zoom) { nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser(); nsIInterfaceRequestor req = (nsIInterfaceRequestor)webBrowser.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID); nsIDocShell docShell = (nsIDocShell)req.getInterface(nsIDocShell.NS_IDOCSHELL_IID); nsIContentViewer contentView = docShell.getContentViewer(); nsIMarkupDocumentViewer docView = (nsIMarkupDocumentViewer)contentView.queryInterface(nsIMarkupDocumentViewer.NS_IMARKUPDOCUMENTVIEWER_IID); float value = zoom / 10f; System.out.println("zoom: " + value); docView.setFullZoom(value); } }
Not sure if this is helpful for zooming programmatically in IE. http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/e542c4e6-acb6-44d4-b742-beab5528ac74