, , ,

Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

Determining if Font is Proportional (OpenInsight 32-Bit)

At 21 APR 2010 08:36:04AM Simon Wilmot wrote:

Hi,

I am looking at an issue within our software … is there a standard way to check if a font is proportional or not.

I notice that a previous programmer has used

 Proportional	= mod(Font,2)

But this reports that Courier is proportional which is not the case.

Urgently needed !!

TIA,

Simon


At 21 APR 2010 09:48AM Simon Wilmot wrote:

Hi,

I have just come across the following - can anyone let me know if I am completely wrong or any amendments to what I am trying.

Using http://msdn.microsoft.com/en-us/library/cc250405(v=PROT.13).aspx

I am using the following code ..

Proportional = False$

Prop_OutPrecision_TT_Values = '3,4,7,8,9,10'

Locate FontStruct in Prop_OutPrecision_TT_Values using ',' setting voidPos then Proportional=True$

Thanks for any help,

Simon


At 21 APR 2010 07:52PM Colin Rule wrote:

If you are using OIPI you can check the CALCTEXT result of two strings that are definitely not the same width such as 'WWWW' and 'iiii'.

If not, sorry for confusing things.

Colin


At 22 APR 2010 03:44AM Simon Wilmot wrote:

Unfortunately not using OIPI - this is in Report Builder, our re-worked version from the first time round …

Simon


At 22 APR 2010 04:03AM Simon Wilmot wrote:

Ok, I now realise my method has a major weakness.

My initial testing to get the OutPrecision setting was from using the Utility ChooseFont option. Unfortunately Get/Set_Property seems to ignore these settings.

Is there a way of extracting this information from the API given the settings we have from a Get_Property ??

Thanks,

Simon


At 22 APR 2010 08:36AM Simon Wilmot wrote:

With a great deal of searching, I have found that I can get the Handle to the font with Send_Message using WM_GetFont.

I have also read that I can use that handle to retrieve the details using GetObject. However, I have yet to get that to work.

Has anyone managed anything similar ??

Simon


At 22 APR 2010 10:38AM Simon Wilmot wrote:

Ok, getting further with this, just need some assistance from someone who has tried something like this before.

The following code works, but doesn't fill in the LogFont structure as I am expecting.

I have tried blank, and strings of @fm,@vm,@svm and ',' with and without a training \00\ but to no avail.

Has anyone got any idea as to what I need to put into LogFont to get the structure back correctly ??

Thanks,

Simon

Equ WM_GetFont$ to 0x0031

CtrlHandle = Get_Property(CtrlEntId, 'HANDLE')

FontHandle = SendMessage(CtrlHandle, WM_GetFont$, , )

LogFont = Str(@svm, 15)

FontInfo = GetObjectA(FontHandle, 64, LogFont)


At 22 APR 2010 11:51AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Y'know Simon the list of fixed fonts is VERY finite. You could just code it as a parameter record - unless your clients are designing their own fonts?

The Sprezzatura Group

The Sprezzatura Blog

World leaders in all things RevSoft


At 23 APR 2010 04:30AM Simon Wilmot wrote:

That may end up being the method I have to use - but it would be nice to have this working properly, ti could well be useful for other users as well !!

My latest efforts are as follows :-

CtrlHandle = Get_Property(CtrlEntId, 'HANDLE')

FontHandle = SendMessage(CtrlHandle, WM_GetFont$, , )

LogFont = Blank_Struct('LOGFONT')

sLen = Struct_Len('LOGFONT')

FontInfo = GetObjectA(FontHandle, sLen, LogFont)

FontDetails = Struct_to_Var(LogFont, 'LOGFONT')

With the LOGFONT structure definition as per the supplied SysObj row, but a SysRepos entry created for it.

This unfortunately supplies a set of zeroes and a char string of 32 Char(0)'s as the name. There must be a simple step that I am missing to get this to work properly ….

Simon

View this thread on the Works forum...