[DUG] Large Fonts/DPI

John Bird johnkbird at paradise.net.nz
Mon Aug 7 14:03:09 NZST 2006


The problem I am having is quite limited and specific.....font size in a
grid

The form I am having trouble with is optionally being scaled using scaleby
(works fine)...

the font for the grid is set to a user choice value.
When running on a screen at 120DPI the font size I set (eg 6 or 8 or 10
point) in the grid seems to be either ignored or treated in some bizarre way
- I get a huge font that I would say looks like 12/14 point or larger...

The font is the default grid font, MS Sans Serif, according to my research
should scale fine and be on all versions Windows

(eg see http://www.angelfire.com/al4/rcollins/style/fonts.html  )

Handy font reference for universally available fonts.

Musings:

Is the MS Sans Serif font the problem? Cos I can change it programmatically
if that's all it is.  From my research it looks 
like MS Sans Serif should be a safe font to use....

I will also experiment with what you suggest using scaleby, as I am already
using this anyway (as you say it does a pretty good job) - but shooting in
the dark as I don't have such a 120DPI screen here..

As for saying "don't use large fonts" I don't think I can do that as the PC
was set up by a network provider who set the large fonts to get the fancy
new big LCD screen to work best with the old PC's version of windows
(windows 98 in most cases) and my software is just one of the programs being
used.....unless there is no other choice!  ;)



John

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Laurence Bevan
Sent: Monday, 7 August 2006 9:44 a.m.
To: delphi at ns3.123.co.nz
Subject: Re: [DUG] Large Fonts/DPI


A quick way of dealing with large fonts is to change the Scaled property of
each form to False, and put this code in the FormCreate:

  Assert(not Scaled, 'You should set Scaled property of Form to False!');
  if Screen.PixelsPerInch <> PixelsPerInch then
    ScaleBy(Screen.PixelsPerInch, PixelsPerInch);

You still have the odd funny looking control but it does a pretty good job
overall. 

Cheers,
Laurence Bevan
Master Business Systems Ltd


----- Original Message -----
From:           	"John Bird" <johnkbird at paradise.net.nz>
To:             	"'NZ Borland Developers Group - Delphi List'"
<delphi at ns3.123.co.nz>
Subject:        	[DUG] Large Fonts/DPI
Date sent:      	Fri, 4 Aug 2006 19:52:29 +1200
Organization:   	John Bird Consulting
Send reply to:  	johnkbird at paradise.net.nz,
       	NZ Borland Developers Group - Delphi List <delphi at ns3.123.co.nz>
	<mailto:delphi-request at ns3.123.co.nz?subject=unsubscribe>
	<mailto:delphi-request at ns3.123.co.nz?subject=subscribe>

[ Double-click this line for list subscription options ] 

I have come across something I have not seen before - and I do not
understand the issues involved and what I need do do, so please help!

Background:
I have some forms I resize according to users screen resolution, and also
settable options which font sizes are to be used in grids, and also default
row height.  Both specified in points.  Behaves nicely on most screens

-Except-

Where screen has been set to use large fonts, eg 120DPI, eg Windows 98 with
a large resolution LCD screen.  The fonts I have set in the grid then become
enormous, nothing like 8 pt which is the default and unreadable.  So how do
I detect the DPI setting, what does it mean for my app, and how do I adjust
the font size.....I am able to do that, but unsure what to adjust.

Any advice or web sites?

John




__________ NOD32 1.1461 (20060329) Information __________

This message was checked by NOD32 antivirus system. http://www.eset.com





More information about the Delphi mailing list