serenity
serenity copied to clipboard
BackgroundPainting: Added a check to compute_text_clip_paths to ensure we are able to produce a path for a given font
Context: Before this commit Ladybird would crash on websites attempting to utilize the clip-background: text property on a node rendered using a bitmap font
This was the case as compute_text_clip_paths
assumed the glyph font was a derived instance of type ScaledFont
. In reality BitmapFont
was passed to the function under the above condition
This commit omits rendering text using the above property for bitmap fonts whilst maintaining it for vector based scaled fonts
This is done by coping the check / error message code from the Gfx library code used when attempting to path-ify bitmap fonts
The optimal solution would be to implement a way for us to calculate outline paths for bitmap fonts however I wanted to reach out and seek some advice of how useful this would be before perusing this.
Test Case:
<html>
<style>
.bitmap {
background-clip: text;
background-color: blanchedalmond;
}
.vector {
background-clip: text;
background-color: blueviolet;
font-family: "Ubuntu";
}
</style>
<body>
<div class="bitmap"> this is a test of a bitmap font</div>
<div class="vector"> this is a test of a vector font</div>
</body>
</html>
Hello!
One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits
CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!