{"action":"opened","issue":{"url":"https://api.github.com/repos/SixLabors/Fonts/issues/75","repository_url":"https://api.github.com/repos/SixLabors/Fonts","labels_url":"https://api.github.com/repos/SixLabors/Fonts/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/SixLabors/Fonts/issues/75/comments","events_url":"https://api.github.com/repos/SixLabors/Fonts/issues/75/events","html_url":"https://github.com/SixLabors/Fonts/issues/75","id":334963353,"node_id":"MDU6SXNzdWUzMzQ5NjMzNTM=","number":75,"title":"Fire an event during font discovery to allow for wiring in font redirects and lazy loading ","user":{"login":"tocsoft","id":166440,"node_id":"MDQ6VXNlcjE2NjQ0MA==","avatar_url":"https://avatars1.githubusercontent.com/u/166440?v=4","gravatar_id":"","url":"https://api.github.com/users/tocsoft","html_url":"https://github.com/tocsoft","followers_url":"https://api.github.com/users/tocsoft/followers","following_url":"https://api.github.com/users/tocsoft/following{/other_user}","gists_url":"https://api.github.com/users/tocsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/tocsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tocsoft/subscriptions","organizations_url":"https://api.github.com/users/tocsoft/orgs","repos_url":"https://api.github.com/users/tocsoft/repos","events_url":"https://api.github.com/users/tocsoft/events{/privacy}","received_events_url":"https://api.github.com/users/tocsoft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-22T17:43:00Z","updated_at":"2018-06-22T17:43:00Z","closed_at":null,"author_association":"MEMBER","body":"add an event to `IFontCollection` that will be called before a font instance is returned that can be used to switch the font instance in the collection with an alternative one. \r\n\r\nAdditionally should be able to register a new font file during this callback and allow the newly installed file to be returned in place of discovered instance.\r\n\r\n``` public class FontDiscoveryEventArgs : EventArgs\r\n{\r\n    public string FontName { get; }\r\n    public FontStyle FontStyle { get; }\r\n    public bool FontFamilyInstalled { get; }\r\n    public bool FontInstalled { get; }\r\n\r\n    public bool UseFont(string path){\r\n       //  .. calls font collection install and then sets the font name and style to the installed font returned\r\n    }\r\n\r\n    public bool UseFont(Stream stream){\r\n       //  .. calls font collection install and then sets the font name and style to the installed font returned\r\n    }\r\n\r\n    public bool UseFont(string fontName, FontStyle style){\r\n        // tries to find the font in the collection if exists then it replaces the final \r\n        // returned font with the newly named one and returns true.\r\n        //if doesn't exist then no change and returns false\r\n    }\r\n}```\r\n\r\nif after the event is called we still don't have a matching font then we will follow the same logic we have now and ultimately throw as required."}}
{"actor":{"display_login":"tocsoft"}}