IonicWind Software

IWBasic => General Questions => Topic started by: Andy on October 01, 2020, 01:07:13 AM

Title: Get font width
Post by: Andy on October 01, 2020, 01:07:13 AM
I'm customising my editor program now, so you can set font size (done) and change font name (on this).

Changing font size doesn't make a difference to my calculation of where you are in the rich edit control (the edit position), BUT, changing the font does.

Now try as I might, I can't find how to get the selected font details - in particular the font width.

In iwbstd.inc we have this:

TYPE LOGFONT
DEF lfHeight as INT
DEF lfWidth as INT
DEF lfEscapement as INT
DEF lfOrientation as INT
DEF lfWeight as INT
DEF lfItalic as CHAR
DEF lfUnderline as CHAR
DEF lfStrikeOut as CHAR
DEF lfCharSet as CHAR
DEF lfOutPrecision as CHAR
DEF lfClipPrecision as CHAR
DEF lfQuality as CHAR
DEF lfPitchAndFamily as CHAR
DEF lfFaceName[32] as ITSTRING
ENDTYPE

But how do I get say the lfWidth value?

There's plenty examples of setting / creating fonts but not getting font details as far as I can see.

Any one done this?

Thanks,
Andy.
Title: Re: Get font width - Solved
Post by: Andy on October 01, 2020, 05:32:59 AM
Found a post eventually on here and amended it.

I can now correctly adjust my edit position.

See attached.

Andy.