Re: Desklib + System Font = Bug?



On 5 Sep, Adam wrote in message
<8117c5614e.admin@xxxxxxxxxxxxxxxx>:

I've had a bug report from someone who uses the system font (RO 4) as
their wimp font and my program is throwing a wobbly.

I've replicated it here (RO 4.39) and appear to have tracked it down
to the Desklib calls - for instance:

font_handle handle;
font_info info;

Font_GetWimpFont(&handle);
Font_ReadInfo(handle, &info);

...produces gobbledegook in info.miny and info.maxy when the system
font is in use (so my redraw routine goes haywire).

Have I done something wrong, or is there a problem with Desklib?

I'm not familiar with Desklib, but shouldn't you be checking the font
handle returned by Font_GetWimpFont() and treating the System Font as a
special case? That's certainly how you would have to do it otherwise.

If all you're doing is plotting text to a window (I'm guessing that this
is MimeMam), then consider either:

1) Using Wimp_PlotIcon and suitable dummy icon definitions in the
template.

2) Using Wimp_TextOp 2 to plot the text and let it worry about the font in
use. Wimp_TextOp 1 lets you work out the width of a string in the current
font.

In the case of MimeMan, 2) might be better, though 1 can have advantages
in terms of setting formatting and so on in the Templates file.

--
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/

.



Relevant Pages

  • Re: Desklib + System Font = Bug?
    ... their wimp font and my program is throwing a wobbly. ... font is in use (so my redraw routine goes haywire). ... or is there a problem with Desklib? ... the system font is in use. ...
    (comp.sys.acorn.programmer)
  • Desklib + System Font = Bug?
    ... I've had a bug report from someone who uses the system font as ... their wimp font and my program is throwing a wobbly. ... or is there a problem with Desklib? ...
    (comp.sys.acorn.programmer)