|
|
Re: Problem with italic Text in Draw2D [message #68642 is a reply to message #68491] |
Thu, 06 March 2003 08:42  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
This looks like a problem with SWT's GC.
Please open a bugzilla against SWT.
"Alex Selkov" <as@empproject.com> wrote in message
news:b4736q$6cf$1@rogue.oti.com...
> Oops... Fonts may have different sizes...
>
> protected static org.eclipse.swt.graphics.Point getStringDimension(String
s,
> Font f) {
>
> setFont(f);
>
> Point result = getGC().stringExtent(s);
>
> if ((f.getFontData()[0].getStyle() & SWT.ITALIC) == SWT.ITALIC)
>
> result.x += Math.max((int)(result.y * 0.04),1);
>
> return result;
>
> }
>
>
> "Alex Selkov" <as@empproject.com> wrote in message
> news:b471ol$4qe$1@rogue.oti.com...
> > On Windows GetTextExtentPoint32 may return innacurate result and italic
> > strings represented incorrectly (see pictures attached).
> >
> > Following hack in FigureUtilites fix this situation but may not work on
> > other platforms :(
> >
> > protected static org.eclipse.swt.graphics.Point
getStringDimension(String
> s,
> > Font f) {
> >
> > setFont(f);
> >
> > Point result = getGC().stringExtent(s);
> >
> > if ((f.getFontData()[0].getStyle() & SWT.ITALIC) == SWT.ITALIC)
> >
> > result.x += 1;
> >
> > return result;
> >
> > }
> >
> >
> >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.72911 seconds