TechTricks
Technical answers from the trenches 
 
 
 
 

   
Detecting Large Fonts
 
   
 Posted: 14 August 2000
 
   
 
 Applies to: Delphi 2.0 and later
 
       
   

Question: How can I tell if my user has Large Fonts enabled?

Answer: The following function shows how to do this:

  function hasLargeFonts : Boolean;
  { --------------------------------------------------------
    Returns a boolean indicating whether or not the user has
    Large Fonts enabled in Display Properties.
    -------------------------------------------------------- }
  var
     liPPI   : longInt;  // holds pixels per inch for canvas
     hCanvas : HDC;      // device context for current canvas

  const
     LGFPPI = 120;       // PPI when LgFonts active
  begin

     hCanvas := getDC( 0 );         // get current canvas
     try
        liPPI := getDeviceCaps( hCanvas, LOGPIXELSX );
     finally
        releaseDC( 0, hCanvas );    // prevent leaks
     end;
     result := ( liPPI = LGFPPI );  // compare and return

  end; // hasLargeFonts

Why is this important?

While Delphi generally handles Large Font issues very nicely, it can affect the appearance of your QuickReport-based reports. For example, previewed reports may not look the same under large font systems than they do in small font based systems. Because of this, you may wish to override some default behaviors. Typical examples include clipped field values, truncated captions, and graphics that don't properly fit their containers.

Also, recent U.S. legislation dictates that anyone providing government services will fully support accessibility issues. If you hope to tap this market with your Delphi applications, you should at least test your application on a system with Large Fonts enabled; you may be surprised at the results.

 

       

Top

Feedback About Paradox Delphi Assorted Web Stuff
 
 
Copyright © 2000-2004, techtricks.com; All Rights Reserved.
Acknowledgements, Disclaimers, Terms and Conditions.
Article last updated on 31 May 2003

 

Other Sites: Paradox, Delphi, Perl, Web Stuff, and More


 

[- End -]