RTFTranslator: Add support for struck-out text

Change-Id: I900d305328513921068ad63a0e3345578bc61c04
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8862
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: John Scipione <jscipione@gmail.com>
This commit is contained in:
Niklas Poslovski 2025-01-26 11:54:28 +01:00 committed by Axel Dörfler
parent c1b2086dfd
commit b697f0ccc8

View File

@ -459,13 +459,17 @@ TextOutput::Command(RTF::Command *command)
PrepareTextRun(fCurrentRun);
set_font_face(fCurrentRun->font, B_BOLD_FACE, command->Option() != 0);
} else if (!strcmp(name, "i")) {
// bold style
// italic style
PrepareTextRun(fCurrentRun);
set_font_face(fCurrentRun->font, B_ITALIC_FACE, command->Option() != 0);
} else if (!strcmp(name, "ul")) {
// bold style
// underscore style
PrepareTextRun(fCurrentRun);
set_font_face(fCurrentRun->font, B_UNDERSCORE_FACE, command->Option() != 0);
} else if (!strcmp(name, "strike")) {
// strikeout style
PrepareTextRun(fCurrentRun);
set_font_face(fCurrentRun->font, B_STRIKEOUT_FACE, command->Option() != 0);
} else if (!strcmp(name, "fs")) {
// font size in half points
PrepareTextRun(fCurrentRun);
@ -779,6 +783,8 @@ status_t convert_styled_text_to_rtf(
rtfFile << "\\ul";
if (fontFace & B_BOLD_FACE)
rtfFile << "\\b";
if (fontFace & B_STRIKEOUT_FACE)
rtfFile << "\\strike";
// RTF font size unit is half-points, but BFont::Size() returns
// points