Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsdetermine Font pixel height outside of GC
https://www.eclipse.org/forums/index.php/mv/msg/142277/448102/#msg_448102
height) without GC? I'm trying to determine the height and I'm not inside a
paint event. The only option I can see is to create my own GC just to
figure out the font pixel height. That seems not very efficient.
-Chris]]>Chris Gross2005-01-02T02:15:05-00:00Re: determine Font pixel height outside of GC
https://www.eclipse.org/forums/index.php/mv/msg/142277/448103/#msg_448103
implemented in internal eclipse functions (if I remember correctly),
they created a GC and disposed of it immediately afterwards. I'm
presuming you're setting the GC's font, then getting the font metrics.
(Then disposing the GC.) I'm not sure how else you'd do it, because the
# of pixels is going to depend on OS, screen resolution, etc... The
javadoc for FontMetrics says "FontMetrics are obtained from GCs using
the getFontMetrics() method."
Chris wrote:
> Can you determine the height of a font (the pixel height not the point
> height) without GC? I'm trying to determine the height and I'm not inside a
> paint event. The only option I can see is to create my own GC just to
> figure out the font pixel height. That seems not very efficient.
>
> -Chris
>
>
--
Liam Morley
Computer Science Undergraduate
Worcester Polytechnic Institute]]>Liam Morley2005-01-02T06:23:22-00:00Re: determine Font pixel height outside of GC
https://www.eclipse.org/forums/index.php/mv/msg/142277/448105/#msg_448105
height of the font from this GC.
Liam Morley wrote:
> I'm pretty sure you have to create a GC; in places where I've seen it
> implemented in internal eclipse functions (if I remember correctly),
> they created a GC and disposed of it immediately afterwards. I'm
> presuming you're setting the GC's font, then getting the font metrics.
> (Then disposing the GC.) I'm not sure how else you'd do it, because the
> # of pixels is going to depend on OS, screen resolution, etc... The
> javadoc for FontMetrics says "FontMetrics are obtained from GCs using
> the getFontMetrics() method."
>
>
> Chris wrote:
>
>> Can you determine the height of a font (the pixel height not the point
>> height) without GC? I'm trying to determine the height and I'm not
>> inside a paint event. The only option I can see is to create my own
>> GC just to figure out the font pixel height. That seems not very
>> efficient.
>>
>> -Chris
>>
>
>]]>strus2005-01-02T12:05:52-00:00Re: determine Font pixel height outside of GC
https://www.eclipse.org/forums/index.php/mv/msg/142277/448114/#msg_448114
Thanks,
-Chris
"Liam Morley" <lmorley@wpi.edu> wrote in message
news:cr840m$suf$1@www.eclipse.org...
> I'm pretty sure you have to create a GC; in places where I've seen it
> implemented in internal eclipse functions (if I remember correctly), they
> created a GC and disposed of it immediately afterwards. I'm presuming
> you're setting the GC's font, then getting the font metrics. (Then
> disposing the GC.) I'm not sure how else you'd do it, because the # of
> pixels is going to depend on OS, screen resolution, etc... The javadoc for
> FontMetrics says "FontMetrics are obtained from GCs using the
> getFontMetrics() method."
>
>
> Chris wrote:
>> Can you determine the height of a font (the pixel height not the point
>> height) without GC? I'm trying to determine the height and I'm not
>> inside a paint event. The only option I can see is to create my own GC
>> just to figure out the font pixel height. That seems not very efficient.
>>
>> -Chris
>
>
> --
> Liam Morley
> Computer Science Undergraduate
> Worcester Polytechnic Institute]]>Chris Gross2005-01-03T14:36:29-00:00Re: determine Font pixel height outside of GC
https://www.eclipse.org/forums/index.php/mv/msg/142277/448115/#msg_448115
"strus" <strus_fr@yahoo.fr> wrote in message
news:cr8o7g$h6b$1@www.eclipse.org...
> In the paint event you can get the gc used : event.gc and find the height
> of the font from this GC.
>
> Liam Morley wrote:
>> I'm pretty sure you have to create a GC; in places where I've seen it
>> implemented in internal eclipse functions (if I remember correctly), they
>> created a GC and disposed of it immediately afterwards. I'm presuming
>> you're setting the GC's font, then getting the font metrics. (Then
>> disposing the GC.) I'm not sure how else you'd do it, because the # of
>> pixels is going to depend on OS, screen resolution, etc... The javadoc
>> for FontMetrics says "FontMetrics are obtained from GCs using the
>> getFontMetrics() method."
>>
>>
>> Chris wrote:
>>
>>> Can you determine the height of a font (the pixel height not the point
>>> height) without GC? I'm trying to determine the height and I'm not
>>> inside a paint event. The only option I can see is to create my own GC
>>> just to figure out the font pixel height. That seems not very
>>> efficient.
>>>
>>> -Chris
>>>
>>]]>Chris Gross2005-01-03T14:36:58-00:00