March 28, 2024, 11:55:51 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Get font width

Started by Andy, October 01, 2020, 01:07:13 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Found a post eventually on here and amended it.

I can now correctly adjust my edit position.

See attached.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.