Tencent / Tencent/libpag

`pagFile.replaceText` with `fillColor` not working, text always black

Open
#2,713 1 comment 0 reactions 1 assignee View on GitHub

@domchen is already working on this.

Since Mar 5, 2025.

Dominant language
HTML
Stars
5.8k
Forks
531
Avg merge
8d 55m
Merged PRs (30d)
17

Description

你好!非常感谢你们的很好的库。我上次提 #2702, 谢谢你们的答复啊。这次更新4.4.x后遇到了一些新的问题 如下:

Which Version of libpag are you using?

libpag 4.4.25

What Platform are you on?

Web

Expected Behavior

Calling replaceText on a loaded pagfile after setting fillColor on a textData should properly set the color of the text data.

Like this:

Image

Actual Behavior

The rendered text is always black, ignoring the fillColor set on the `textData.

Image

Code Example

Bug repro can be found in this repo:
https://github.com/johncalvinroberts/libpag-text-test

Specifically:

					const textData = pagFile.getTextData(i);
					textData.fillColor = { red: 255, green: 255, blue: 0 };
					textData.text = "REPLACE";
					pagFile.replaceText(i, textData);

Upload the pag file below to show the bug -- text is always black.

PAG File

bad_pag_file_with_text.pag.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.