Skip to content

Issue with IntalledTypefaceFontCollectionExtensions.Register() #232

@ilovebt9

Description

@ilovebt9

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions