mirror of
https://github.com/penpot/penpot.git
synced 2025-07-13 16:17:17 +02:00
🐛 Fix text fill gradients and add visual regression test for text styles
This commit is contained in:
parent
bbb9713f97
commit
5c120b601c
4 changed files with 3112 additions and 8 deletions
3098
frontend/playwright/data/render-wasm/get-file-text-styles.json
Normal file
3098
frontend/playwright/data/render-wasm/get-file-text-styles.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -84,3 +84,16 @@ test("Renders a file with texts that use custom fonts", async ({ page }) => {
|
|||
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with styled texts", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-text-styles.json");
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "6bd7c17d-4f59-815e-8006-5c2559af4939",
|
||||
pageId: "6bd7c17d-4f59-815e-8006-5c2559af493a",
|
||||
});
|
||||
await workspace.waitForFirstRender();
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 515 KiB |
|
@ -344,14 +344,7 @@ impl TextLeaf {
|
|||
) -> skia::textlayout::TextStyle {
|
||||
let mut style = skia::textlayout::TextStyle::default();
|
||||
|
||||
let bounding_box = Rect::from_xywh(
|
||||
content_bounds.x(),
|
||||
content_bounds.y(),
|
||||
self.font_size * self.text.len() as f32,
|
||||
self.font_size,
|
||||
);
|
||||
|
||||
let paint = merge_fills(&self.fills, bounding_box);
|
||||
let paint = merge_fills(&self.fills, *content_bounds);
|
||||
style.set_foreground_paint(&paint);
|
||||
style.set_font_size(self.font_size);
|
||||
style.set_letter_spacing(paragraph.letter_spacing);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue