Change the font of a String

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of thom schumacher thom schumacher 7 months, 4 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34859
    Profile photo of thom schumacher
    thom schumacher
    Participant

    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
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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
    Profile photo of thom schumacher
    thom schumacher
    Participant

    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.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.