Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Spec #4842

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Font Spec #4842

wants to merge 7 commits into from

Conversation

ryfu-msft
Copy link
Contributor

@ryfu-msft ryfu-msft commented Oct 1, 2024

Related to #166

Adds the initial font specification document. This outlines the planned implementation for supporting fonts. This will be updated to match the actual implementation.

Microsoft Reviewers: Open in CodeFlow

@ryfu-msft ryfu-msft requested a review from a team as a code owner October 1, 2024 15:34
@ryfu-msft ryfu-msft marked this pull request as draft October 1, 2024 15:34

This comment has been minimized.


If a user specifies a specific name such as :

`winget fonts list --name 'Arial'`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this support a substring match like winget list? Can I do something like winget fonts list --name 'Nerd Font' (display all nerd fonts installed on my system) or winget fonts list 'Italic' (list out all italic fonts)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or also --version, --exact, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking of creating an index in memory that we can use to better search the installed fonts like the examples you have above.

doc/specs/#166 - Font Support.md Show resolved Hide resolved

### Font File Types

This feature will support font files with the following file types:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From our talks, do we actually need to specify the file types that are supported? It seemed like we could support whatever font formats Windows supports with no additional work per-type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for general knowledge, I don't plan to do anything different based on file type. Installation support will be based on the results from IdWriteFontFile::Analyze

doc/specs/#166 - Font Support.md Show resolved Hide resolved
doc/specs/#166 - Font Support.md Outdated Show resolved Hide resolved
---

### 1. Initial Validation
Winget will check that `effectiveInstallerType == font` before kicking off the font installation flow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this check is necessary. My expectation is that we:

  1. Have a separate source for fonts, marked as explicit
  2. winget fonts install is the same as winget install -s winget-fonts (or whatever the name of the source is).
  3. The actual workflow is identical post source selection; the font installer type is not special.

The goal is logically separate fonts for our repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated spec to align with this. Made sure to call out that the workflow should not change post source selection.


`winget fonts uninstall --name 'Baskerville Old Face'`

Winget will uninstall a font family with a single font face without any warnings.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A warning should only be generated when the set of things being removed would be larger than the set of things requested to be removed. Specifying a single face might require removing multiple faces or families because they are all in the same file. This applies to all uninstall command permutations.

So generally:

  1. determine the set of files that back the target
  2. determine the set of faces that this will remove
  3. if there are faces outside of the target, warn and require --force

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated spec to align with above.

doc/specs/#166 - Font Support.md Outdated Show resolved Hide resolved

4. **Uninstalling a font face that shares the same font file as another font face:**

`winget fonts uninstall --name 'Arial' --font-face 'Bold'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this example and example 1 exist together. It doesn't seem like name has a consistent meaning across these commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that using a font family that includes the word 'face' was slightly confusing...

I've updated the arguments to more accurately reflect the difference between --family-name and --face-name

doc/specs/#166 - Font Support.md Show resolved Hide resolved
doc/specs/#166 - Font Support.md Outdated Show resolved Hide resolved
doc/specs/#166 - Font Support.md Outdated Show resolved Hide resolved

This comment has been minimized.

@denelon
Copy link
Contributor

denelon commented Oct 2, 2024

From a PowerShell point of view are we thinking something like: WinGetFont as the Object type as opposed to a WinGetPackage?

@JohnMcPMS
Copy link
Member

From a PowerShell point of view are we thinking something like: WinGetFont as the Object type as opposed to a WinGetPackage?

I would prefer not to have to create an entire COM and PowerShell interface that is 90% the same with different names. That does mean a slant mapping of faces to versions. But version can be used to describe different flavors of things, and faces of fonts are just versions of the primary theme. So it still fits, somewhat.

> Font types will not be treated differently. Support for font installation will be determined by calling [IDWriteFontFile::Analyze](https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfile-analyze).

### Installing Fonts
Typically, a user would download the font file and drag it to the `C:\Windows\Fonts` directory in the explorer view, but there are a couple things happening behind the scenes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the drag and drop flow trigger the same endpoints as double clicking the file in File Explorer? Just trying to understand if all the current methods of installing fonts end up at the same place



## Manifest Changes
- Addition of `font` to `installerType` and `nestedInstallerType`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way for the manifest to specify the font name and not just the path to it? Thinking of a use case where the file is something like ARandomFont.ttf when it the name of the font is actually something like Really Awesome Font

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the font files contain face and family metadata already and we are planning to always use that. If that is not always the case, then we do probably need a way to specify the name. The registry value names don't appear to have any actual impact on the enumerated fonts (from what I remember of @ryfu-msft investigation), but maybe they are important in the event that the file doesn't contain the relevant metadata.


If a user specifies a specific name such as :

`winget fonts list --name 'Arial'`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or also --version, --exact, etc.


### 1. Selection From Font Source
Font source:
There will be a separate source specifically for fonts. This source will be marked as explicit. The workflows following font source selection will be the same as if an executable package was selected. A user will be enter the following commands and experience the same behavior of installing a font.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this new source interact with the GPO for allowed / disallowed sources?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question for @denelon

The new source was just my thought on how we would separate the data and keep the index size from growing. My expectation is that it would respect configured policy just the same, but the question is whether it would be in the umbrella of some existing controls or not (the one that controls the winget source for example).


## CLI Behavior / Implementation Details

New Command: `winget fonts`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be any new GPO to prevent the installation of fonts, or uninstallation of specific fonts?

Thinking about how an enterprise could use a custom standard font for all of their branding / marketing and would want to ensure that users at the company can't uninstall it using WinGet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how will this interact with existing Font GPOs, if at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants