Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Form font size craziness


This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 10 - Last Post: Nov 10, 2016 7:16 AM Last Post By: Trevor Cooper
Trevor Cooper

Posts: 45
Registered: 10/7/10
Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 6, 2016 6:08 AM
Hi,

We have a number of applications that have been through many versions of Delphi in the last 20 years, from Delphi 2 to 10.1 Berlin, and comprise hundreds of forms developed on various machines over the years.

Now, viewing in 10.1 Berlin, typically we have the situation that the TForm and standard VCL components such as TLabel, TEdit are all reporting at design time to be using exactly the same font. But the form caption is clearly in a smaller font than the text displayed by the TLabel and TEdit, whose text no longer fits into the space originally allocated.

I've seen a lot of discussion on the internet about this, and there's a lot of opinion to assimilate and stuff to read through. Is there a definitive and easy-to-follow guide to what's changed and we need to do to avoid having to redesign hundreds of forms? Or is this going to become an utter nightmare?

Trevor Cooper
Rudy Velthuis (...


Posts: 7,731
Registered: 9/22/99
Re: Form font size craziness
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 7, 2016 12:32 AM   in response to: Trevor Cooper in response to: Trevor Cooper
Trevor Cooper wrote:

Hi,

We have a number of applications that have been through many versions
of Delphi in the last 20 years, from Delphi 2 to 10.1 Berlin, and
comprise hundreds of forms developed on various machines over the
years.

Now, viewing in 10.1 Berlin, typically we have the situation that the
TForm and standard VCL components such as TLabel, TEdit are all
reporting at design time to be using exactly the same font. But the
form caption

The Font for a Form is not the font of the caption, it is the font for
the client area. The font of a caption is a systemwide setting for all
forms and windows on your installaton of Windows.

--
Rudy Velthuis http://www.rvelthuis.de

"A single death is a tragedy, a million deaths is a statistic."
-- Joseph Stalin.
Trevor Cooper

Posts: 45
Registered: 10/7/10
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 7, 2016 3:19 AM   in response to: Rudy Velthuis (... in response to: Rudy Velthuis (...
Rudy,

Ah! I didn't know that! Maybe I should have done after all these years. Is it written somewhere?

So, the form caption itself is fine, it's just all the thousands of components on hundreds of forms that aren't. They all have ParentFont = True. So in principle I ought to be able to reduce the size of the font for the TForm e.g. in the Object Inspector, and see an immediate improvement. Well, I can see an immediate change if I pick a different font, or increase its size, but there's no response if I try to reduce the font size, as though Size = 8, Height = -11 is the smallest that can be achieved with for DEFAULT_CHARSET, MS Sans Serif.

Is that a known limit, also documented somewhere?

Thanks for your advice!

Regards

Trevor Cooper
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: Form font size craziness
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 7, 2016 4:28 AM   in response to: Trevor Cooper in response to: Trevor Cooper
Trevor Cooper wrote:

Rudy,

Ah! I didn't know that! Maybe I should have done after all these
years. Is it written somewhere?

So, the form caption itself is fine, it's just all the thousands of
components on hundreds of forms that aren't. They all have ParentFont
= True. So in principle I ought to be able to reduce the size of the
font for the TForm e.g. in the Object Inspector, and see an immediate
improvement. Well, I can see an immediate change if I pick a
different font, or increase its size, but there's no response if I
try to reduce the font size, as though Size = 8, Height = -11 is the
smallest that can be achieved with f or DEFAULT_CHARSET, MS Sans
Serif.

Is that a known limit, also documented somewhere?

Google and Wikipedia are your friends:
https://en.wikipedia.org/wiki/MS_Sans_Serif

MS Sans Serif is available in the font sizes 8, 10, 12, 14, 18, and 24.
When changing dpi settings in Windows 95 or later (in Windows 3.1, dpi
setting is tied to screen resolution, depending on driver information
file), Windows is configured to load a different MS Sans Serif font,
historically called the "8514" variant, which adds sizes 23 and 30
points.
 
Today, the font is still available in all editions of Windows 7 (a Euro
symbol was added for the release of Windows 98), and is still used in
menus, dialog boxes, etc. The name "Helv" is still used in Windows as a
synonym for MS Sans Serif.
Trevor Cooper

Posts: 45
Registered: 10/7/10
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2016 2:04 AM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Thanks Lajos, that's very helpful.

So, it seems that I have the choice of redesigning component sizes on all forms, or picking a different font for all forms. Switching from MS Sans Serif to Arial seems to be a good choice, but that's still hundreds of forms to review and edit.

Can anyone tell me, should I have seen this coming?
Rudy Velthuis (...


Posts: 7,731
Registered: 9/22/99
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2016 3:17 AM   in response to: Trevor Cooper in response to: Trevor Cooper
Trevor Cooper wrote:

Thanks Lajos, that's very helpful.

So, it seems that I have the choice of redesigning component sizes on
all forms, or picking a different font for all forms. Switching from
MS Sans Serif to Arial seems to be a good choice, but that's still
hundreds of forms to review and edit.

Can anyone tell me, should I have seen this coming?

I don't know if you should have seen it, but perhaps give a simple
solution: If your forms (dfms) are in text form, you could perhaps
simply do a search and replace with a suitable program.

--
Rudy Velthuis http://www.rvelthuis.de

"I spent thirty-three years in the marines, most of my time
being a high-class muscle man for big business, for Wall Street
and the bankers. In short, I was a racketeer for capitalism."
-- General Smedley Butler, Marine
Trevor Cooper

Posts: 45
Registered: 10/7/10
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2016 4:39 AM   in response to: Rudy Velthuis (... in response to: Rudy Velthuis (...
Good idea Rudy! I imagine I could use 'reFind' to do this.

Also, I note that in our more recently developed applications, Delphi has defaulted to 'Tahoma' rather than 'MS Sans Serif', and 'Tahoma' looks perfect with no changes needed. So maybe it's only the very old forms started in early versions of Delphi that need attention.

Do we know if or when Delphi made the change, or is that a Windows thing too?
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2016 7:21 AM   in response to: Trevor Cooper in response to: Trevor Cooper
Trevor Cooper wrote:

Good idea Rudy! I imagine I could use 'reFind' to do this.

Also, I note that in our more recently developed applications, Delphi
has defaulted to 'Tahoma' rather than 'MS Sans Serif', and 'Tahoma'
looks perfect with no changes needed. So maybe it's only the very old
forms started in early versions of Delphi that need attention.

Do we know if or when Delphi made the change, or is that a Windows
thing too?

The dfm files can be also saved as binary. Before reFind it's idea to
check whenever all the files are saved as text or not (I made the
mistake that I didn't checked before a search and replace in files. I
was a bit lucky only a couple of files were still saved as binary and I
could fix those files quickly).

I don't know for sure when the swithch of the default font was made.
Tried a bit to google but cannot find any link stating when was the
change made. What I've found that D2005 is using Tahoma as default and
that in Delphi 6 it was MS Sans Serif. I cannot find any links about
what was the default font in Delphi 7.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2016 10:55 AM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Lajos wrote:

I don't know for sure when the swithch of the default font was made.

The switch was either in Delphi 8, 2005, or 2006 (I don't have VCL sources
for D8 or D2005 to check, but I do have D7 and D2006).

The default is always hard-coded to 'MS Sans Serif' in the VCL source code,
bu it is potentially overwritten at runtime. In Delphi 2006 and later, the
default font name is replaced with one of the following possible values:

- if a font substitution for 'MS Shell Dlg 2' is defined in the Registry,
the specified font name is used (on my Win7 machine, it is 'Tahoma').

- else if the machine is running Win9x/ME with a ShiftJIS default charset,
'Tahoma' is used.

- else 'MS Sans Serif' is used.

I cannot find any links about what was the default font in Delphi 7.

It is 'MS Sans Serif', unless the app is run on a FarEast machine with a
ShiftJIS default charset, then the default font name is replaced with '‚l‚r
‚oƒSƒVƒbƒN', whatever that refers to (probably some Unicode font name in
ShiftJIS encoding).

--
Remy Lebeau (TeamB)
Trevor Cooper

Posts: 45
Registered: 10/7/10
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 10, 2016 7:16 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy,

Thanks or the insight. I have a new machine here with HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes\MS Shell Dlg 2 = 'Tahoma', but in newly installed 10.1 Berlin, the default font for pre-existing forms remains 'MS Sans Serif', at design time and runtime, as it was in XE2, and, presumably, versions going back to the original in Delphi 2.

It is, however, 'Tahoma' for new forms.

So the font substitution doesn't affect pre-existing forms. Is that what you'd expect?

It seems you need a fair bit of specialist insight to follow what's going on here. How should the software developer keep up with these seemingly arbitrary and unannounced changes made by Microsoft or in Rad Studio, or both, I wonder. How should we know to look out for font substitutions affecting specifically 'MS Shell Dlg 2'?

I feel suddenly very ignorant.

Cheers

Trevor Cooper
Carl-Henrik Nil...

Posts: 53
Registered: 3/26/02
Re: Form font size craziness  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2016 11:59 PM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Lajos Juhasz wrote:
Trevor Cooper wrote:
I don't know for sure when the swithch of the default font was made.
Tried a bit to google but cannot find any link stating when was the
change made. What I've found that D2005 is using Tahoma as default and
that in Delphi 6 it was MS Sans Serif. I cannot find any links about
what was the default font in Delphi 7.

D7 has MS Sans Serif and D2005 has Tahoma as default font.
--
C-H
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02