{"id":9481,"date":"2006-10-15T19:39:00","date_gmt":"2006-10-15T19:39:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2006\/10\/15\/windows-powershell-font-customization\/"},"modified":"2019-02-18T13:21:15","modified_gmt":"2019-02-18T20:21:15","slug":"windows-powershell-font-customization","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/windows-powershell-font-customization\/","title":{"rendered":"Windows PowerShell Font Customization"},"content":{"rendered":"<p><!--\n \/* Font Definitions *\/\n @font-face\n\t{font-family:\"Cambria Math\";\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\n@font-face\n\t{font-family:Cambria;\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\n@font-face\n\t{font-family:Calibri;\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;}\n@font-face\n\t{font-family:Consolas;\n\tpanose-1:2 11 6 9 2 2 4 3 2 4;}\n \/* Style Definitions *\/\n p.MsoNormal, li.MsoNormal, div.MsoNormal\n\t{margin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:0in;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\nh1\n\t{mso-style-link:\"Heading 1 Char\";\n\tmargin-top:24.0pt;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:0in;\n\tmargin-bottom:.0001pt;\n\tline-height:115%;\n\tpage-break-after:avoid;\n\tfont-size:14.0pt;\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#365F91;}\np.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle\n\t{mso-style-link:\"Subtitle Char\";\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:0in;\n\tline-height:115%;\n\tfont-size:12.0pt;\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#4F81BD;\n\tletter-spacing:.75pt;\n\tfont-style:italic;}\na:link, span.MsoHyperlink\n\t{color:blue;\n\ttext-decoration:underline;}\na:visited, span.MsoHyperlinkFollowed\n\t{color:purple;\n\ttext-decoration:underline;}\np.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing\n\t{mso-style-link:\"No Spacing Char\";\n\tmargin:0in;\n\tmargin-bottom:.0001pt;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\nspan.MsoSubtleEmphasis\n\t{color:gray;\n\tfont-style:italic;}\np.Code, li.Code, div.Code\n\t{mso-style-name:Code;\n\tmso-style-link:\"Code Char\";\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:.5in;\n\tmargin-bottom:.0001pt;\n\tfont-size:8.0pt;\n\tfont-family:Consolas;}\nspan.NoSpacingChar\n\t{mso-style-name:\"No Spacing Char\";\n\tmso-style-link:\"No Spacing\";}\nspan.CodeChar\n\t{mso-style-name:\"Code Char\";\n\tmso-style-link:Code;\n\tfont-family:Consolas;}\nspan.Heading1Char\n\t{mso-style-name:\"Heading 1 Char\";\n\tmso-style-link:\"Heading 1\";\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#365F91;\n\tfont-weight:bold;}\nspan.SubtitleChar\n\t{mso-style-name:\"Subtitle Char\";\n\tmso-style-link:Subtitle;\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#4F81BD;\n\tletter-spacing:.75pt;\n\tfont-style:italic;}\n@page Section1\n\t{size:8.5in 11.0in;\n\tmargin:.5in .5in .5in .5in;}\ndiv.Section1\n\t{page:Section1;}\n--><\/p>\n<div class=\"Section1\">\n<h2>Windows PowerShell Font Customization<\/h2>\n<p class=\"MsoNormal\">&nbsp;<\/p>\n<p class=\"MsoNormal\">&lt;Today we have a guest blog entry from another team in Microsoft&gt;<\/p>\n<p class=\"MsoNormal\">There\u2019s a new set of fonts that have been developed and released this year bundled with the betas for the new Windows and Office.&nbsp; These <a href=\"http:\/\/blogs.msdn.com\/jensenh\/archive\/2005\/12\/07\/501009.aspx\">6 fonts<\/a> are collectively called The <a href=\"http:\/\/www.microsoft.com\/resources\/design\/ClearType.html\">Microsoft ClearType Font Collection<\/a>.&nbsp; They are designed for on-screen reading with ClearType enabled.&nbsp; In short, this means that if you have an LCD display then text written in these fonts will be more readable.&nbsp; One of these fonts in particular, Consolas, is of interest to us programmers, shell scripters and IT folk.&nbsp; Consolas is described as \u201ca monospaced font (like an old typewriter) and good for programmers setting code (its core purpose).\u201d&nbsp; We\u2019re going to install it for use in PowerShell.<\/p>\n<p class=\"MsoNormal\">First of all, you need to obtain the font.&nbsp; If you have the <a href=\"http:\/\/www.microsoft.com\/windowsvista\/getready\/default.mspx\">Windows Vista beta<\/a> or the <a href=\"http:\/\/www.microsoft.com\/office\/preview\/beta\/getthebeta.mspx\">Office 2007 beta<\/a>, you already have it.&nbsp; If you have a licensed copy of Visual Studio 2005, you can <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&amp;displaylang=en\">download the Consolas font for free<\/a>.&nbsp; Another prerequisite is to <a href=\"http:\/\/support.microsoft.com\/kb\/q306527\/\">enable ClearType on your LCD<\/a>.&nbsp; If ClearType is not enabled then Consolas will actually <i>look worse<\/i> than using the default fonts!<\/p>\n<p class=\"MsoNormal\">The next step, once the font is installed, is to register it for use in the Console.&nbsp; You can run the PS script below (provided by Lee Dohm) <i>as an administrator<\/i> or you can <a href=\"http:\/\/support.microsoft.com\/default.aspx?scid=kb;EN-US;Q247815\">follow the manual steps in KB article Q247815<\/a>.<\/p>\n<p class=\"MsoNormal\">You then need to log out (on Vista) or reboot on XP (log out might be sufficient but I haven\u2019t tried it.)&nbsp; Then open up a console, click the control box (upper left corner of the window) and choose Properties.&nbsp; The Font tab contains a list of Console-enabled fonts including the new entry, Consolas.&nbsp; Choose it, pick a nice size for it and click Ok. <\/p>\n<p class=\"Code\">$key = &#8220;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Console\\TrueTypeFont&#8221;<br \/>&nbsp;<br \/>## Find out if Consolas is installed on the system<br \/>if(!(test-path (join-path $env:windir &#8220;Fonts\\CONSOLA.TTF&#8221;)))<br \/>{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write-host &#8220;The Consolas font is not installed on the system.&#8221;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write-host &#8220;Install Microsoft Office 2007 Beta to obtain the font.&#8221;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break<br \/>}<br \/>&nbsp;<br \/>## Determine if Consolas is already installed as a command window font<br \/>$installed = get-itemproperty $key |<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get-member |<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where-object { $_.Name -match &#8220;^0+$&#8221; } |<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where-object { $_.Definition -match &#8220;Consolas&#8221; }<br \/>if($installed -ne $null)<br \/>{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write-host &#8220;The Consolas font is already installed as a command window font.&#8221;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break<br \/>}<br \/>&nbsp;<br \/>## Find out what the largest string of zeros is<br \/>$zeros = (get-itemproperty $key |<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get-member |<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where-object { $_.Name -match &#8220;^0+$&#8221; } |<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;measure-object).Count<br \/>&nbsp;<br \/>## Install the font<br \/>new-itemproperty $key -Name (&#8220;0&#8221; * ($zeros + 1)) -Type string -Value &#8220;Consolas&#8221;<br \/>write-host &#8220;Consolas font installed successfully as a command window font.&#8221;<\/p>\n<p class=\"MsoSubtitle\"><span class=\"MsoSubtleEmphasis\"><span><\/span><\/span>&nbsp;<\/p>\n<p class=\"MsoSubtitle\"><span class=\"MsoSubtleEmphasis\"><span>Aaron Lieberman is a developer at Bungie Studios focused on user interface and networking.<br \/>Lee Dohm is a developer in MSTV Engineering Services Build &amp; Tools and wrote the script.<\/span><\/span><\/p>\n<p class=\"Code\">&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Windows PowerShell Font Customization &nbsp; &lt;Today we have a guest blog entry from another team in Microsoft&gt; There\u2019s a new set of fonts that have been developed and released this year bundled with the betas for the new Windows and Office.&nbsp; These 6 fonts are collectively called The Microsoft ClearType Font Collection.&nbsp; They are designed [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9481","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Windows PowerShell Font Customization &nbsp; &lt;Today we have a guest blog entry from another team in Microsoft&gt; There\u2019s a new set of fonts that have been developed and released this year bundled with the betas for the new Windows and Office.&nbsp; These 6 fonts are collectively called The Microsoft ClearType Font Collection.&nbsp; They are designed [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/9481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=9481"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/9481\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=9481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=9481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=9481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}