{"id":102297,"date":"2004-07-14T07:00:00","date_gmt":"2004-07-14T14:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/07\/14\/how-do-you-detect-large-fonts\/"},"modified":"2004-07-14T07:00:00","modified_gmt":"2004-07-14T14:00:00","slug":"how-do-you-detect-large-fonts-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040714-00\/?p=102297","title":{"rendered":"How do you detect &#8220;Large Fonts&#8221;?"},"content":{"rendered":"<p>\nWhen people ask, &#8220;How do I detect Large Fonts&#8221;, they aren&#8217;t\nreally asking how to detect Large Fonts specifically.\nRather, Large Fonts is just the most common manifestation\nof &#8220;unusual DPI&#8221;.\n<\/p>\n<p>\nWindows uses a nominal DPI of 96 pixels per inch.\nIn other words, if Windows wants to draw a line that is one inch\nlong, it draws 96 pixels.  Of course, the physical length of this\nline depends on your screen resolution and the size of your monitor.\nThe value of 96 is merely nominal.\n<\/p>\n<p>\nYou can change this DPI setting from the Display control panel,\neither by choosing Large Fonts, or by choosing a custom font size.\nStandard size is 96DPI.  Large is 120DPI.  Custom is, well, custom.\n<\/p>\n<p>\nDPI higher than 96 will become more and more prevalent as LCD technology\nimproves.\n<\/p>\n<p>\nPrograms can query the DPI setting by asking GetDeviceCaps for\nthe LOGPIXELSX of the screen DC.\n<\/p>\n<pre>\nint GetScreenDPI()\n{\n  HDC hdcScreen = GetDC(NULL);\n  int iDPI = -1; \/\/ assume failure\n  if (hdcScreen) {\n    iDPI = GetDeviceCaps(hdcScreen, LOGPIXELSX);\n    ReleaseDC(NULL, hdcScreen);\n  }\n  return iDPI;\n}\n<\/pre>\n<p>\nThe code above assumes that pixels are square, which is true\nof most modern devices.  (You can choose an odd screen resolution\nand get non-square pixels, but most people avoid such resolutions.)\nBack in the old days, there were\nmany devices with non-square pixels.\nFor example, the EGA video adapter had pixels which were 1.33 times\nas tall as they were wide.\n<\/p>\n<p>\nFor nonsquare-pixel devices, the values of the LOGPIXELSX and\nLOGPIXELSY metrics will be different.  On an EGA, if the value\nof the LOGPIXELSX metric were 96, then the LOGPIXELSY metric\nwould be 72, since there are only 72 vertical pixels per inch.\nSimilarly, the ASPECTX, ASPECTY and ASPECTXY values for\nnonsquare-pixel devices will be somewhat interesting as well,\nas this diagram demonstrates:\n<\/p>\n<p>  36\n  27\n  45<\/p>\n<div id=\"vmlContent\" STYLE=\"height: 160pt;width: 130pt\">\n<p>if (document.namespaces) {\n document.namespaces.add(&#8216;v&#8217;, &#8216;urn:schemas-microsoft-com:vml&#8217;, &#8220;#default#VML&#8221;);\n for (var i = 0; i &lt; vmlContent.length; i++) vmlContent[i].style.display = &quot;block&quot;;\n if (vmlContent.style) vmlContent.style.display = &quot;block&quot;;\n for (var i = 0; i &lt; svgContent.length; i++) svgContent[i].style.display = &quot;none&quot;;\n if (svgContent.style) svgContent.style.display = &quot;none&quot;;\n}<\/p>\n<p>  <span>36<\/span>\n  <span>27<\/span>\n  <span>45<\/span>\n<\/div>\n<p>\nThe ASPECTX is 27 and the ASPECTY is 36, representing the 4:3 ratio\nof vertical to horizontal, and the ASPECTXY is 45, representing the\nhypotenuse.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s the system DPI setting.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-102297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>It&#8217;s the system DPI setting.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/102297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=102297"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/102297\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=102297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=102297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=102297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}