From 90064cb2ffb08a09aac21e4ecc8de9ca1e3312eb Mon Sep 17 00:00:00 2001 From: Vincent Politzer Date: Fri, 23 Jan 2026 21:53:35 -0800 Subject: [PATCH] Add comments, improve readability --- lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp b/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp index da8ac382..602dcbf2 100644 --- a/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp +++ b/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp @@ -40,18 +40,18 @@ bool matches(const char* tag_name, const char* possible_tags[], const int possib return false; } +// flush the contents of partWordBuffer to currentTextBlock void ChapterHtmlSlimParser::flushPartWordBuffer() { + // determine font style EpdFontFamily::Style fontStyle = EpdFontFamily::REGULAR; - if (boldUntilDepth < depth) { - if (italicUntilDepth < depth) { - fontStyle = EpdFontFamily::BOLD_ITALIC; - } else { - fontStyle = EpdFontFamily::BOLD; - } + if (boldUntilDepth < depth && italicUntilDepth < depth) { + fontStyle = EpdFontFamily::BOLD_ITALIC; + } else if (boldUntilDepth < depth) { + fontStyle = EpdFontFamily::BOLD; } else if (italicUntilDepth < depth) { fontStyle = EpdFontFamily::ITALIC; } - + // flush the buffer partWordBuffer[partWordBufferIndex] = '\0'; currentTextBlock->addWord(partWordBuffer, fontStyle); partWordBufferIndex = 0;