Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT Rotated text
SWT Rotated text [message #449529] Tue, 25 January 2005 19:34 Go to next message
Eclipse UserFriend
Originally posted by: jmiller.acclaimvision.org

I have an application being developed on Win32 as an Eclipse plug-in. Can
I tweak the LOGFONT structure in FontData, specifically:

org.eclipse.swt.internal.win32.LOGFONT

I specify the orientation as:

myFontInstance.data[0].lfOrientation = 450; // specified as 10ths of
degrees

This has no effect when I render the text for this font set on the GC
using the following API:

gc.drawText(myText, x, y);

So, how do I rotate text (I would prefer to use OS specific calls versus
rotating an image)?

- Janet
Re: SWT Rotated text [message #449534 is a reply to message #449529] Tue, 25 January 2005 21:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cvskt.yahoo.com

Set 'myFontInstance.data[0].lfEscapement = 450;' instead.

However, gc.drawText(...) would clip off the rotated text rendered because
it assumes horizontal (0 degree) rendering when computing the bounding
rectangle.

So that's not very useful.

---

Janet Miller wrote:

> I have an application being developed on Win32 as an Eclipse plug-in. Can
> I tweak the LOGFONT structure in FontData, specifically:

> org.eclipse.swt.internal.win32.LOGFONT

> I specify the orientation as:

> myFontInstance.data[0].lfOrientation = 450; // specified as 10ths of
> degrees

> This has no effect when I render the text for this font set on the GC
> using the following API:

> gc.drawText(myText, x, y);

> So, how do I rotate text (I would prefer to use OS specific calls versus
> rotating an image)?

> - Janet
Re: SWT Rotated text [message #449535 is a reply to message #449529] Tue, 25 January 2005 21:47 Go to previous messageGo to next message
Rohit Colaco is currently offline Rohit ColacoFriend
Messages: 36
Registered: July 2009
Member
On Win32, the OS specific code does the following:

if ((flags & SWT.DRAW_DELIMITER) == 0) uFormat |= OS.DT_SINGLELINE;
if ((flags & SWT.DRAW_TAB) != 0) uFormat |= OS.DT_EXPANDTABS;
if ((flags & SWT.DRAW_MNEMONIC) == 0) uFormat |= OS.DT_NOPREFIX;

They should've provided support for a line of code like this:

if ((flags & SWT.DRAW_NOCLIPPED) == 0) uFormat |= OS.DT_NOCLIP;

If DT_NOCLIP is not specified, text gets clipped for an internally
computed rectangle.

Hopefully that will be available in a newer SWT release.

Until then, seems like image rotation to represent rotated text is the
only solution.

- Rohit

---

Janet Miller wrote:

> I have an application being developed on Win32 as an Eclipse plug-in. Can
> I tweak the LOGFONT structure in FontData, specifically:

> org.eclipse.swt.internal.win32.LOGFONT

> I specify the orientation as:

> myFontInstance.data[0].lfOrientation = 450; // specified as 10ths of
> degrees

> This has no effect when I render the text for this font set on the GC
> using the following API:

> gc.drawText(myText, x, y);

> So, how do I rotate text (I would prefer to use OS specific calls versus
> rotating an image)?

> - Janet
Re: SWT Rotated text [message #449536 is a reply to message #449535] Tue, 25 January 2005 22:45 Go to previous message
Stefan Zeiger is currently offline Stefan ZeigerFriend
Messages: 102
Registered: July 2009
Senior Member
Rohit Colaco wrote:

> Until then, seems like image rotation to represent rotated text is the
> only solution.

Note that hacks like this will look very ugly with ClearType font rendering.

--
Stefan Zeiger http://www.szeiger.de http://www.novocode.com
My SWT controls: http://www.novocode.com/swt
Previous Topic:Help API
Next Topic:EditorPart and close button
Goto Forum:
  


Current Time: Wed Sep 25 11:58:34 GMT 2024

Powered by FUDForum. Page generated in 0.04697 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top