Silverfrost Forums

Welcome to our forums

Font and font size

1 Apr 2017 9:48 #19320

Beginning with the main program, I use %fn[MS SANS SERIF]%ts with .96D0 (size, argument for %ts) in any winio@ window, which means dozens of times within one single program. My question is, whether there is a way to define font and font size once at the beginning of the code, for all subsequent windows?

Thanks in advance Wilfried

1 Apr 2017 10:19 #19321

You can use %gf after the first time, storing the result as a font HANDLE. This will be a 64 bit integer in 64 bit applications.

Then use %fh to set the font using the saved font HANDLE afterwards.

But the font HANDLE will probably be destroyed when the first window closes so this may only work if the handle is created in a main window that remains open.

1 Apr 2017 10:39 #19322

Paul knows better than me how Clearwin+ works best, but I have a subroutine that sets up all the window attributes, font and font size, background colour etc etc, which I call each time I open a new window. The subroutine contains nothing but the associated winio@ calls, which as you know, can be strung out over several routines.

As the system font is different in various versions of Windows, especially with large font settings, it takes care of all that too.

Eddie

1 Apr 2017 10:42 #19323

Thank you, but that is not really the solution I was looking for:

Instead of each time using %fn[MS SANS SERIF]%ts with an argument for %ts, I then would need each time %fh with an argument, coming from an additional common block or module…

I am looking for a solution similar to set_clearwin_float@('rf_exp_limit',0.001D0) with which I once for all suppress exponential writing of double precision values in %rf. This is one single statement at the beginning of the main program.

Regards - Wilfried

1 Apr 2017 10:49 #19324

Sorry Eddie, my previous post was an answer to Paul's remarks. Your way with a subroutine for all general settings is another interesting alternative.

Wilfried

1 Apr 2017 11:38 #19325

Wilfried, your post reminded me once more about a shortcoming of the Silverfrost forum setup (phpBB): there is no convenient way of referring to a particular post in a thread. We can reply to what we think of as the 'most recent' post, but another reader may post while I am composing, and as a result what I post has to be edited (if I catch the problem). I can count from the top and say '#4', but that will give wrong information to another reader who may hav a different setting for the order of presentation, and is too irksome to use in threads with dozens of posts.

I can quote the time/date of the post, but the times/dates that different readers see are different for any given post. I have now two browser tabs, one of which goes through a VPN filter and the other straight. I see 4:49 AM for your most recent post in one tab, and 11:49 AM for the same post in the other tab.

Paul, please make it possible to add a serial number to each of the posts in a thread.

1 Apr 2017 11:56 #19326

Wilfried

I can't find anything better than Eddie's suggestion but it would be a fairly simple matter to add something to ClearWin+ so that you could set a default font for all subsequent Windows created via winio@.

1 Apr 2017 12:27 #19327

I just had a look, and I see that for XP and earlier, I have used MS Sans Serif, with scaling factors 0.8 for y pixels less than 1000, 0.9 for bigger vertical pixel counts, but for Vista and later, the scaling factors are 0.9 and 1.0. I'm using CALL GET_OS_VER@(ID_Platform, MAJOR, MINOR) to decide which version of Windows it runs on.

Interestingly, I only use scaling factors 0.8 (XP & earlier) and 0.9 (Vista and later) with the relevant fonts for dialog boxes that just pop up with warnings.

Using Segoe UI means installing it on a Vista machine.

1 Apr 2017 1:05 #19328

I have added a new routine CLEARWIN_DEFAULT_FONT@(hfont) and will aim to upload a new set of DLLs early next week.

If it works then you will be able to call this routine after (say) using %gf in the first Window to be opened at run time.

1 Apr 2017 4:53 #19329

Thanks again, Paul and Eddie!

I modified one of my programs according to Eddie's suggestion, with good results. Next time I will try Paul's new routine.

Have a nice weekend! Wilfried

2 Apr 2017 7:08 #19332

On reflection, I might be able to provide something more useful instead.

I am thinking of a function winstyle@ that would work like winio@ but only for certain format codes such as %fn, %ts, %bf, %tc and %bg. This would create a predefined window style for all subsequent calls to winio@. Basically it would automatically store an accumulated format string that would be applied on the first call to winio@ for any subsequent window.

I am assuming that this format string would be internal to ClearWin+ but I suppose that it might even be in a user buffer that the user could then store and change but maybe that would be a bridge too far.

If we take this approach then it will take a little longer to implement.

2 Apr 2017 10:26 #19335

Paul,

It's a generous offer, but at the risk of sounding ungrateful, isn't this something that can be supplied by a user using standard existing Clearwin+ and Fortran?

When launching any user interaction window, raw execution speed ceases to be a problem as most computers (including my Windows tablet) are effectively instantaneous. It therefore isn't a problem to nest a few extra subroutine calls - and they shouldn't affect the stack much because they involve few parameters.

Hence, surely the best short term solution is to provide some way of illustrating what can be done by way of a sample subroutine or two?

Eddie

2 Apr 2017 8:37 #19336

Windows style, Linux rubber Windows style, tablet style, Apple or Android phone style, night style, etc would be ultimately great final touch of Clearwin. We all see how many great looking styles of sliders, buttons and radio buttons, backgrounds exist...Would be great to refresh our programs with new nice looks... Beauty and ugly difference is the matter of few microns color layer and its shape.

3 Apr 2017 7:08 #19342

Eddie

Thanks for your concern. I think that your approach is simple and very effective. What I am planning is just a nice little diverting exercise for me that I will offer free of charge.

Please login to reply.