Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up2d canvas font code panics on default system font on HL2 #27166
Comments
|
We'll need to make this optional and just ignore text operations when we can't find fonts to avoid panics like this; we should also figure out how to load the default fallback font on UWP as well. |
|
Using https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text, I see the "Hello world" text on desktop macOS and Windows nightlies, and a blank canvas in the UWP nightly. I'm going to try and fix that. |
|
Ok, so the path we follow gets us to https://github.com/servo/font-kit/blob/efb64bcd3fdaf21a46a0edb086a4f157264a54ea/src/source.rs#L146 before we encounter any errors. We have a FontHandle that corresponds to the Font::from_handle takes us to https://github.com/servo/font-kit/blob/3f5c183ecfbbba9af388307e495031c6c0b7cf47/src/loader.rs#L69, where we take the path branch and end up in https://github.com/servo/font-kit/blob/3f5c183ecfbbba9af388307e495031c6c0b7cf47/src/loader.rs#L62. At this point, we:
It's not really clear to me why we open a file from a path, then try to determine the path to that file handle. I also need to figure out what the winapi says the actual underlying error is at this point, since the docs claim that's a valid function to call from UWP apps. |
|
Ok, not super surprisingly, the underlying error is |
|
#27184 will make the crash go away. I've submitted servo/font-kit#156 to fix the underlying problem, which will allow the actual text to appear when we update to a version of font-kit that includes that change. |
From a log on a user's device: