Change the font of a String

Welcome Forums General PowerShell Q&A Change the font of a String

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #34859

    Participant
    Points: 42
    Rank: Member

    Is it possible with PowerShell to change the font of a string.. So that you can use Wing dings in output when using write-output or other cmdlets that deal with output?

    'string'.fontName = wingdings

    I know you can change the font in the Ise with
    $psise.Options.FontName = 'font name'

    How can you do the same thing with a string

  • #34860

    Keymaster
    Points: 1,673
    Helping HandTeam Member
    Rank: Community Hero

    The console application only supports specific, hardcoded fonts, and doesn't provide the ability to change just a particular string. The ISE supports a wider range of fonts, but it's a global setting – you can't change the display of a particular string. A string doesn't have a font associated with it; the font is determined by the application displaying the string.

  • #34865

    Participant
    Points: 42
    Rank: Member

    Thanx Don. I wondered if that wasnt' the case on the hardcoding.. Thanx for the confirmation.

    As you described I played around with this
    [System.Drawing.FontFamily]::Families

    and setting my $psise.options.fontname

    [System.Drawing.FontFamily]::Families |?{$_.name -like 'wing*'}

    If someone isn't looking this is a good Joke to play on someone change their font to some non nonsensical font... oh boy... you have to type out what you want in another window then run it again.

    Thanx again Don.

The topic ‘Change the font of a String’ is closed to new replies.