Windows "Large Fonts" <--> "Small Fonts" problem...

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Dave Bezair » Thu, 23 Nov 2000 04:00:00



I am developping an application which I expect to be used on a variety of
different system configurations.  The problem I am encountering is Win9x
font sizes.  If the user has Large Fonts selected, my Forms are all
distorted.  How can i fix this problem, and make the application look right
regardless of Windows "Large Fonts" or "Small Fonts"?

Any help would be greatly appreciated.

Cheers,
Dave Bezaire

 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Phil McRev » Thu, 23 Nov 2000 04:00:00


[Please do not mail me a copy of your followup]



Quote:>How can i fix this problem, and make the application look right
>regardless of Windows "Large Fonts" or "Small Fonts"?

You can query the system metrics to find out the size of the font and
then adjust your form that way.  Note that you can't assume that
"Large Font" means any particular font because the user can customize
it completely.  However, Windows does keep an idea of what particular
font is selected as the "small" and "large" fonts at any given
moment.

You can find the exact size of the font selected by using
GetTextMetrics.  The default font selected into a DC is SYSTEM_FONT.
--
Ask me about my upcoming book on Direct3D from Addison-Wesley!
<http://www.veryComputer.com/~legalize/> Legalize *hood!
    ``Ain't it funny that they all fire the pistol,    
      at the wrong end of the race?''--PDBT    

 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Maynard Philbroo » Tue, 28 Nov 2000 12:21:56


if you don't want to allow for scaling then set your scale := false, and make
sure you have enough room
around your menus and window type controls that display text to fixed the
bleeding problem of large fonts.
or support your app with SCALE := true and let your app scale it self.

> I am developping an application which I expect to be used on a variety of
> different system configurations.  The problem I am encountering is Win9x
> font sizes.  If the user has Large Fonts selected, my Forms are all
> distorted.  How can i fix this problem, and make the application look right
> regardless of Windows "Large Fonts" or "Small Fonts"?

> Any help would be greatly appreciated.

> Cheers,
> Dave Bezaire


 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Maynard Philbroo » Tue, 28 Nov 2000 12:26:08


P.S.
 due to a king in the way Delphi sets your scale using the font size you can
trick the system into using a smaller font and end up with the correct size you
need.
for example in your formCreate of each form.
Font.Size := Trunc(8*(96/Screen.PixelsPerInch));
that in turn will trick the Delphi code in the background into selecting the
real 8 point font..
other wise when you specify 8 you will actuall get something like 10 or 11 if
the user is running large font.
by doing that little trick it will attemp something like 6 but Delphi will set
it to like 8 ..
and set your scale := false
 and you should  be set.

> I am developping an application which I expect to be used on a variety of
> different system configurations.  The problem I am encountering is Win9x
> font sizes.  If the user has Large Fonts selected, my Forms are all
> distorted.  How can i fix this problem, and make the application look right
> regardless of Windows "Large Fonts" or "Small Fonts"?

> Any help would be greatly appreciated.

> Cheers,
> Dave Bezaire


 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by John A. Gran » Tue, 28 Nov 2000 14:34:33



    [...]
Quote:> Font.Size := Trunc(8*(96/Screen.PixelsPerInch));

    I don't know what Delphi's "Trunc()" does, but consider
    using the Win API MulDiv() for expressions like this:
        Font.Size:=MulDiv(8,96,Screen.PixelsPerInch);
--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Finn Tolderlun » Tue, 28 Nov 2000 16:01:12




Quote:> for example in your formCreate of each form.
> Font.Size := Trunc(8*(96/Screen.PixelsPerInch));
> that in turn will trick the Delphi code in the background into selecting
the
> real 8 point font..

This is generally a bad advice.

Quote:> other wise when you specify 8 you will actuall get something like 10 or 11
if
> the user is running large font.
> by doing that little trick it will attemp something like 6 but Delphi will
set
> it to like 8 ..

There is actually a reason for Windows to have Large fonts.
It enables people with low visual capacity to see the text.
Making the text smaller despite the users choice is bad programming.

Finn Tolderlund

 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Jussi Jumppane » Tue, 28 Nov 2000 04:00:00





> > for example in your formCreate of each form.
> > Font.Size := Trunc(8*(96/Screen.PixelsPerInch));
> > that in turn will trick the Delphi code in the background into selecting

> This is generally a bad advice.
> .......
> There is actually a reason for Windows to have Large fonts.
> It enables people with low visual capacity to see the text.
> Making the text smaller despite the users choice is bad programming.

I totally agree. A better way would be detecting the selection of
the large fonts and then adjust the delphi forms accordingly. The
only problem is the detection of the large fonts does seem to be a
bit of a hack:

  KB article Q177795, "INFO: Large Fonts Versus Small Fonts
                      Use in Windows"
    http://support.microsoft.com/support/kb/articles/q177/7/95.asp

  KB article Q137556, "How to Determine Which Are in Use: Small
                       or Large Fonts" (this KB has a bug -- it
                       doesn't detect smaller than small, between
                       small and large or larger than large)."
    http://support.microsoft.com/support/kb/articles/q137/5/56.asp

Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, WordStar, Emacs) Text Editor
"The C/C++, Java, HTML, Pascal, Cobol, Fortran programmer's text editor"
http://www.zeusedit.com

 
 
 

Windows "Large Fonts" <--> "Small Fonts" problem...

Post by Mark Leyde » Thu, 11 Jan 2001 08:06:06


Detecting the settings is one thing, but resizing forms, controls, objects
and so on is not necessarily possible, realizing a logical inch in small
fonts is still a logical inch in large fonts.  Therefore, if your form,
control, object is sized to a logical inch, then it should be sized that way
regardless of the dpi that has been set.  In other words, a rectangle that
is a logical inch wide (set by the value returned from GetDeviceCaps(hDC,
LOGPIXELSX)) in small fonts will be the equivalent in large fonts, though
120 pixels wide rather than 96 pixels wide.  For text formatting, this is,
unfortunately, not the case.  If the boundry (a rectangle with a width of a
logical inch) of your text (font: Microsoft Sans Serif-8pt), when designed
in small fonts, is tight to the edge of the last character, in large fonts
it will unlikely fit.  If it was designed in large fonts, it is likely that
there is undesired space between the edge of the rectangle and the last
character.  Sorry for the long winded detail, but I am getting to my
point... If you take a line of text containing 13 capital letter-S
characters (Microsoft Sans Serif-8pt), in small fonts, the string width will
be 91 pixels (five short of a logical inch). In large fonts, the string
width is 117 pixels (three short of a logical inch).  So...

...and finally, the question is, how do you format and/or output your text
so that these differences are taken into account?  Microsoft Word does it.
When I output my text (of the above example) it is exactly 7 pixels per
character, equallying a string width of 91.  In Microsoft Word, the same
text and font has a width of 94 pixels (or thereabouts).  Starting from
about the fifth character onwords, it seems that the text shifts slightly to
the right, as if one or more character columns (extents) are larger.  In
large fonts, Microsoft Word displays the same text and font slightly smaller
than the one I have outputted.  Basically, I am lost!  I can't find anything
that will give me a hint on how to deal with this difference.  I've used the
example of Microsoft Sans Serif-8pt because it displays the most visible
difference, but this problem is evident with all fonts and various sizes.
What I am looking for is away to get my text string to display as closely
(closer than I have been able to achieve) to the size (extent) in any dpi.
Any help would be greatly appreciated.

Thanks in advance,
Mark.

 
 
 

1. Windows display properties, "large fonts | small fonts" - where to check status?

Can anyone help me with this?

I need to know, *before* I open a window, if the Win95 display
properties/settings are set to "Small Fonts" or "Large Fonts".

Depending on this setting, windows changes your font size and
I *must* know what the font size will be prior to opening this
window.

I looked thru the registry but didn't see anything there; nor
have the searches I've been able to think of in the MSVC docs
turn up anything. :(

Thanks for any pointers.
--

Ben Williams (ARS AA7AS)

Black Belt Systems, Inc. State of the Art Image Manipulation Software
Versions for: Win 3.1 - Win95 - Win NT (Alpha, MIPS, PowerPC & Intel)

Web Pages:   http://www.blackbelt.com/blackbelt/bx_top.html
FTP:         ftp.blackbelt.com/corporate/blackbelt/




2. Rootkits for windows

3. Help: operator ">>", "<<" with double

4. Cocoon beginner problem

5. Operator ">>", "<<" with double

6. site-check and comments please

7. cout << "(" << ")";

8. "own" vs "uses" vs "contains" vs "is a"

9. C syntax in DIB image size calculation: ">>" and "~"

10. Removing "My Computer", "Recycle Bin" and "Network Neighborhood" from desktop

11. Why "public" "private" "protected"

12. extern "FORTRAN", extern "Pascal", extern "Ada" ... ?