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

Windows system font loader loads older font when multiple version is present #69

Open
RagibHasin opened this issue Aug 8, 2024 · 3 comments

Comments

@RagibHasin
Copy link

RagibHasin commented Aug 8, 2024

As this crate loads every font from C:\Windows\Fonts directly, it loads a potentially older version of a font, if the older version comes first in the file list.

For example, in C:\Windows\Fonts

     LastWriteTime      Name
     -------------      ----
16 Mar 23  3:21 PM      iosevka-ahad-regular.ttf
17 Mar 23  8:59 PM      iosevka-ahad-regular_0.ttf

Here iosevka-ahad-regular_0.ttf is of a later date and is registered with the Windows registry. However, as iosevka-ahad-regular.ttf comes first, it gets loaded which leads to a deviation of behavior from other software.

@RazrFalcon
Copy link
Owner

fontdb isn't designed to replace the system API and not designed to replicate its edge cases.

Is this Windows behavior specified anywhere? Are you suggesting we're suppose to sort fonts by data/time as well?

@RagibHasin
Copy link
Author

RagibHasin commented Aug 8, 2024

If we don't want to access Windows font management APIs, then I think there are two options:

  1. Read the font list from the registry
    • Benefit: almost the same thing the font management API internally does, so maximal compatibility
    • Drawback: still needs to access some platform-specific APIs
  2. Sort the fonts by date-time
    • Benefit: no need for any platform-specific API
    • Drawback: there may be some font that has an older timestamp but is registered with the registry

@RazrFalcon
Copy link
Owner

I will think about. Low priority.

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

No branches or pull requests

2 participants