Giter Site home page Giter Site logo

Comments (4)

linyinfeng avatar linyinfeng commented on May 27, 2024 1

@h404bi I don't known whether or not fonts installed by the new method can be used by any application. In my test some application can not use these fonts. I believe that compatibility of the new installation method needs more inspection. Maybe both installation methods should be kept.

from scoop-nerd-fonts.

linyinfeng avatar linyinfeng commented on May 27, 2024

Updated again...
I retest the installer and uninstaller following on 1903 and find it is not working now. Last time I use these script is several months ago because my switching to other system(now I am back on win). Some Windows mechanism may be changed and it is no longer working. I am sorry for this wrong script.
The work can be done by replacing installer and uninstaller like this:

"installer": {
    "script": [
        "New-Item -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\Scoop.%name' -Force | Out-Null",
        "Get-ChildItem `$dir -filter '*Windows Compatible.*' | ForEach-Object {",
        "    New-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\Scoop.%name' -Name `$_.Name -Value `$_.FullName -Force | Out-Null",
        "}"
    ]
},
"uninstaller": {
    "script": [
        "Remove-Item -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\Scoop.%name'",
        "Write-Host \"The '`$(`$app.Replace('-NF', ''))' Font family has been uninstalled and will not be present after restarting your computer.\" -Foreground Magenta"
    ]
}

Changes made to registry will looks like this:
2019-05-21
Also, changes to fonts can be immediately viewed in Settings - Personalization - Fonts.

A problem is, the Windows Font Cache Service(FontCache) does not automatically detect changes of this registry key and the service does not update font cache at boot time by default to reduce boot time of Windows. A restart of FontCache service can fix missing of installed fonts, but this requires admin rights and a restart may not be a reliable way to accomplish this task. I don't find approaches to build font cache for newly added fonts without admin rights. This might cause problem.

My fork of the repository for my personal use installs fonts without admin rights: linyinfeng/scoop-nerd-fonts. I am not actively maintaining the fork and it may be buggy. But it can serves as a simple working example for the issue.

from scoop-nerd-fonts.

chawyehsu avatar chawyehsu commented on May 27, 2024

@linyinfeng Thanks for your information, this is really helpful!
@matthewjberger Would you like to adopt this to support non-admin installation? Maybe we should add conditions to check if the user's machine is under Windows 10 17704 or later, for backward compatibility.

from scoop-nerd-fonts.

linyinfeng avatar linyinfeng commented on May 27, 2024

Tried to copy fonts to AppData\Local\Microsoft\Windows\Fonts and modified registry keys. Installed fonts in this directory seem work well.
Font files not in the directory seems take effect when fonts cache was rebuilt and disappear after system reboot. So maybe we can't just leave font files in the app directory of scoop and only create registry keys for them like the script described above in my comment, which I thought is a nice and clean way.

Update:
I ignored permission problem. Fonts can not be accessed by service like FontCache because some services have no read permission to scoop apps directory. By properly set read rights for them in ACL, we can install fonts just in the default location of scoop.
A problem is to find out what ACL rules should be added to which files or directories to make font cache services and all applications including Font settings work.

from scoop-nerd-fonts.

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.