-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use MSWord compatible RTF sequence for background text color (#16035)
The `GenRTF(...)` was using `\highlight` control word for sending background text color in the RTF format during a copy command. This doesn't work correctly, since many applications (E.g. MSWord) don't support full RGB with `\highlight`, and instead uses an approximation of what is received. For example, `rgb(197, 15, 31)` becomes `rgb(255, 0, 255)`. Also, the standard way of using background colors is `\cbN` control word, which isn't supported as per the [RTF Spec 1.9.1] in Word. But it briefly mentioned a workaround at Pg. 23, which seems to work on all the RTF editors I tested. The PR makes the changes to use `\chshdng0\chcbpatN` for the background coloring. Also did some refactoring to make the implementation concise. ## Validation Steps Performed Verified that the background is correctly copied on below editors: - MSWord - WordPad - LibreOffice - Outlook [RTF Spec 1.9.1]: https://msopenspecs.azureedge.net/files/Archive_References/[MSFT-RTF].pdf
- Loading branch information
Showing
2 changed files
with
38 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,8 +188,10 @@ changelist | |
chaof | ||
charinfo | ||
CHARSETINFO | ||
chcbpat | ||
chh | ||
chk | ||
chshdng | ||
CHT | ||
Cic | ||
cielab | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters