forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Logical screen dpi

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat May 22, 2010 4:52 pm    Post subject: Logical screen dpi Reply with quote

In my experience, FTN95/Clearwin programs are relatively insensitive to the user choice of standard or large fonts, although there are occasional cases where it matters a lot.

The case which continues to give me problems is in the spacing of %tb toolbar icons if a non-standard "Logical dpi" setting is in effect. Ordinarily, the spacing of toolbar icons set with %tb or %ib is handled perfectly well by Clearwin. The case where it is not handled well is where the icons are expected to touch, thus forming a continuous bar (as, for example, one sees in the Office 2003 suite). Then, what looks like an arbitrary amount of extra spacing is added by Windows/Clearwin (I don't know which), although it is not actually arbitrary but is a matter of the "logical average character width" on the basis of which things are spaced out.

I have found 3 workarounds. In the first, there is a different set of icons for use when a non-standard fonts setting is enabled. In the second, I "slide" an appropriate bitmap under the icons so that the gaps don't show - this is possible with %bm, as the toolbar buttons always present themselves in the foreground. The third workaround is to space the buttons pixel by pixel. In all cases, it is necessary to do the adjustments while "building" the toolbar. That means knowing whether the "Large fonts" or "Custom size" setting has been enabled. I suppose there is a fourth option, and that is not to use %tb.

In all cases (except the last), it is necessary to detect whether or not the font size selected is "Standard".

Using functions documented in FTN95.chm, it is difficult to find the font size setting, as although the "Logical pixels in x" parameter can be retrieved from a current drawing surface once one has been created by means of (and using the handle iHDC to a %gr drawing surface):

Code:
        CALL Get_Current_DC@ (iHDC)
        ixdpi = GetDeviceCaps(iHDC, LOGPIXELSX)
        iydpi = GetDeviceCaps(iHDC, LOGPIXELSY)


this definitely doesn't work for the screen, and once a drawing surface has been created, it is too late to do toolbars. It seems that ixdpi=96 and iydpi=96 are the "standard" settings, and the "large fonts" setting is 120 for both. Presumably, "Custom" means anything else, and differences in the x and y settings mean that the pixels aren't square, which I haven't seen for a while.

Amazingly, the answer turns out to be trivial, as the device context for the monitor can be found using

Code:
      iHDC = GetDC (0)


after which GetDeviceCaps works.

I hope that this is of some use to somebody out there.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group