This becomes a VERY interesting problem. my system, after selecting Large
Fonts, there's no change in the DPI but there's a change in the actual font
size for "Message Box"; I tryed reading the DPI using all the tricks I know,
it's allways 96. Also reading this mailing list it seems I'm the NLY one
that doesn't get a change in DPI when switching to Large Fonts!
The problem with fonts changing without actually changing DPI is that
Delphi's code for automatically scaling forms on load will not work.
Like many other programmers I allways avoided the Large Font problem (by
setting Scaled = False) but that will no longer work and that's because of
LCD displays: All the LCD's I've seen work at a native resolution that's too
high for anyone using reading glasses, and there are lots of people using
reading glasses! CRT monitors people that need to have taller fonts can
always run a lower resolution. This is not possible on LCD's so the only
solution is "Large Fonts".
At the moment I'm manually scaling my forms (using ScaleBy) in proportion
with the change in message box font size. So far this worked very well and
it has a few benefits: I can scale frames created at run time! Delphi by
itself will only scale stuff that's on the form at design time. You allready
noticed the only refference to Scaled in the Forms unit is in the code for
ReadState.
Also scaling my forms in proportion to "Message Box Font" has a hidden
advantage: Selecting Large Fonts is one way the user can inform Windows
he/she actually wants larger fonts, but the user can also manually customize
this font making it any size (s)he whishes!
For I'm going to go with this solution, running a few experiments on my
customers :-)
Rob Kennedy wrote:
Cosmin Prund wrote:
>That would make sence. Unfortunatelly PixelsPerInch says 96 on both
>my "normal fonts" developement machine AND on my "Extra Large Fonts"
>test machine.
>
PixelsPerInch tells the resolution of the screen on which the form was
designed. That way, the form will know how much to scale itself by
when it runs on a different screen.
But there are two PixelsPerInch properties. belongs to TForm.
That's no good. The other belongs to TScreen. Use that one to
determine the font size.
Also note that font size is no longer limited to just "small" and
"large." Many video drivers allow you to choose a resolution of your
own; 96 and 120 are common, but you can also find 200, or 126, or 108,
or any other value. Rather than ask, "Am I in large-font mode?" you
need to ask, "What font size am I in?" and then do some math to
compensate.
You can see how TForm accounds for font size by looking in
TCustomForm.ReadState, in Forms.pas. It adjusts the font size right
after its inherited call.
Delphi mailing list -Delphi (AT) elists (DOT) org