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

Issue with IntalledTypefaceFontCollectionExtensions.Register() #232

Open
ilovebt9 opened this issue Feb 17, 2024 · 0 comments
Open

Issue with IntalledTypefaceFontCollectionExtensions.Register() #232

ilovebt9 opened this issue Feb 17, 2024 · 0 comments

Comments

@ilovebt9
Copy link

ilovebt9 commented Feb 17, 2024

Hello,

I'm discovering Typography project, and i'm happy with this, i'm may be wrong with something, but it seem there is an issue with register function.

When I'm adding Windows font folder in Collection, duplicate handler callback is called severals times with non duplicate font

example from my console testing program, arial and arial narrow

opening : C:\Windows\Fonts
is_directory
duplicate font :
 keep : Arial C:\Windows\Fonts\arial.ttf
 discard : Arial Narrow C:\Windows\Fonts\ARIALN.TTF

i checked if there is any mistake in file naming but no, you can reproduce issue on windows

string filepath = "C:\Windows\Fonts";
var fontCollection = new FontCollections.InstalledTypefaceCollection();
fontCollection.SetFontNameDuplicatedHandler((f1, f2) => {
    Console.WriteLine("duplicate font :");
    Console.WriteLine(" keep : {0} {1}", f1.FontName, f1.FontPath);
    Console.WriteLine(" discard : {0} {1}", f2.FontName, f2.FontPath);
    Console.WriteLine("");
    return FontNameDuplicatedDecision.Skip; 
});
Typography.FontCollections.InstalledTypefaceCollectionExtensions.LoadFontsFromFolder(fontCollection, filepath);

may it's be good to have a chain starting with comparing UniqueFontIden and then fallback to less sementically revelents parameters ?

@ilovebt9 ilovebt9 changed the title Issue with IntalledTypeFont.Register() Issue with IntalledTypefaceFontCollectionExtensions.Register() Feb 17, 2024
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

1 participant