{"id":120,"date":"2007-05-12T14:35:28","date_gmt":"2007-05-12T12:35:28","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/small-fonts-large-fonts\/"},"modified":"2007-05-12T14:35:30","modified_gmt":"2007-05-12T12:35:30","slug":"small-fonts-large-fonts","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/small-fonts-large-fonts\/","title":{"rendered":"Small Fonts \/ Large Fonts&#8230;"},"content":{"rendered":"<p><em>>I have a Delphi program written on a computer with small fonts installed.<br \/>\n>When this is run on a computer with identical properties except for the fact<br \/>\n>that large fonts are being used all the controls on the forms seem to have<br \/>\n>expanded in size leading to scrollbars appearing on all the forms. The forms<br \/>\n>themselves seem to remain at the correct size.<br \/>\n><br \/>\n>How can I resolve this so that it will work correctly on a system with<br \/>\n>either font size?<br \/>\n<\/em><br \/>\n<!--more--><br \/>\n<b>A1:<\/b><br \/>\nI&#8217;m wondering if you have maximum size form constrains ?<br \/>\nThis could be preventing Delphi from resizing the form as<br \/>\nwell as all the controls.  Add code like what follows to<br \/>\ndetect and address the problem.<\/p>\n<p>on create event<\/p>\n<p>[code lang=&#8221;delphi&#8221;]var<br \/>\n    Ratio: double;<br \/>\nbegin<br \/>\n    Ratio := Self.PixelsPerInch \/ 96;<br \/>\n    Self.Contraints.MaxWidth := Self.Contraints.MaxWidth * Ratio;<br \/>\n    Self.Contraints.MaxHeight := Self.Contraints.MaxHeight * Ratio;<br \/>\n    Self.Width := Self.Width * Ratio;<br \/>\n    Self.Height := Self.Height * Ratio;<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p><b>A2:<\/b><br \/>\na simple solution see &#8220;large fonts&#8221; on<br \/>\nhttp:\/\/www.inner-smile.com\/delphifaq.htm , it says :<\/p>\n<p>Design on large fonts, use only truetype fonts, set the forms Scaled<br \/>\nproperty to false. That works pretty well on smallfont systems. You<br \/>\njust have to make sure that your form does not become larger than the<br \/>\nusers screen size. This can be handled by a simple check in the forms<br \/>\nOnCreate procedure, call<\/p>\n<p>SystemparametersInfo( SPI_GETWORKAREA, 0, @aRect, 0 );<\/p>\n<p>Check if your forms width or height exceed the dimensions of aRect, if<br \/>\nso you set your forms Boundsrect := aRect; and the forms AutoScroll<br \/>\nproperty to true. It then gets scrollbars but that is better than<br \/>\nhaving parts of the form not accessible by the user.<\/p>\n<p><b>A3:<\/b><br \/>\nYou can design in small fonts. Just set Scaled to false, and use a<br \/>\nTrueType font (rather than MS Sans Serif). Also, don&#8217;t anchor things to<br \/>\nthe bottom or right&#8211;Delphi has a bug with that if Scaled is false.<\/p>\n<p><b>A4:<\/b><br \/>\nPeople who switch to &#8216;large fonts&#8217; do this because they find the small<br \/>\nfonts hard to read.  So everything should grow with large fonts.  This<br \/>\nmeans your &#8216;fixed-size&#8217; (not scrollable) forms must expand in size.<\/p>\n<p>Set the form&#8217;s Scaled property to True, and the AutoScroll property to<br \/>\nFalse.<\/p>\n<p>[tags]Delphi, Forms[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>>I have a Delphi program written on a computer with small fonts installed. >When this is run on a computer with identical properties&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,100],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-1W","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/120"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}