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

BackgroundPainting: Added a check to compute_text_clip_paths to ensure we are able to produce a path for a given font #24216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1JSIkora
Copy link

@1JSIkora 1JSIkora commented May 5, 2024

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>

image

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 5, 2024
@BuggieBot
Copy link
Member

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.

@1JSIkora 1JSIkora force-pushed the fix-bitmap-path-crash branch 2 times, most recently from d59730f to 8ee09cf Compare May 5, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 pr-needs-review PR needs review from a maintainer or community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants