Giter Club home page Giter Club logo

Comments (2)

devblackops avatar devblackops commented on June 12, 2024 3

Definitely @potatoqualitee! I see others are having issues with getting the fonts working as well. I'll try to make that process clear.

from terminal-icons.

indented-automation avatar indented-automation commented on June 12, 2024

It's been a bit painful trying to get this to work today. Only a limited number of fonts seem to be viable and fonts like Consolas seem to refuse to patch in a compatible manner.

However, I think I've successfully patched Lucida Console now. I have icons in PS 5 and 6 and it's very pretty.

You are welcome to the how-to I made for my colleagues if it helps at all :)

How to: Patch Lucida Console font

Clone nerd-fonts

This creates a shall clone of the nerd-fonts repository. This is a large repository and may take some time to clone, even with depth set to 1.

Pull request 288 includes a fix for mono-spaced fonts compatible with conhost (powershell, cmd.exe, and so on).

git clone --depth 1 git@github.com:ryanoasis/nerd-fonts.git
Push-Location nerd-fonts
git fetch origin --depth 1 pull/288/head:monospace-fixed
git checkout monospace-fixed

Enable TLS1.2 on PowerShell 5

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 'Tls12'

Acquire portable fontforge

$params = @{
    Uri     = 'https://iweb.dl.sourceforge.net/project/fontforgebuilds/x86_64/Portable/FontForge-mingw-w64-x86_64-65163d-r1.7z'
    OutFile = '.\fontforge.7z'
}
Invoke-WebRequest @params

Unzip using 7-zip

The method below uses chocolatey to install 7-zip. This may be substituted or skipped as appropriate.

The archive content is unzipped to the current directory, nerd-fonts.

#Requires -RunAsAdministrator

choco install 7zip.portable -y
7z x -o"$($pwd)" fontforge.7z

Fix-up environment variables

$env:PYTHONHOME = $pwd
$env:PYTHONPATH = Join-Path $pwd 'lib\python3.7'
$env:PATH = '{0};{0}\bin;{1}' -f $pwd, $env:PATH

Patch Lucidia

New-Item patched -ItemType Directory
ffpython font-patcher -s -c -w c:\windows\fonts\lucon.ttf -out .\patched

Install the font

#Requires -RunAsAdministrator

$shell = New-Object -ComObject Shell.Application
$fontsFolder = $shell.Namespace(0x14)

Get-ChildItem patched | ForEach-Object {
    $fontsFolder.CopyHere($_.FullName)
}

Add the font to the built-in console list

#Requires -RunAsAdministrator

$fonts = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts').PSObject.Properties
Get-ChildItem patched | ForEach-Object {
    $fontName =  $fonts |
        Where-Object Value -like ('{0}*' -f $_.BaseName) |
        ForEach-Object { $_.Name -replace ' \(.+$' }

    $params = @{
        Path  = $path = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont'
        Name  = '{0}0' -f ((Get-ItemProperty -Name '0*' -Path $path).PSObject.Properties.Match('0*').Name | Sort-Object { $_.Length } | Select-Object -Last 1)
        Value = $fontName
    }
    Set-ItemProperty @params
}

from terminal-icons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.