From 13a6c43b87e6a427fea0d19a56c395551d5bf919 Mon Sep 17 00:00:00 2001 From: Arthur Tazhitdinov Date: Wed, 17 Dec 2025 18:24:09 +0300 Subject: [PATCH] clang format fix --- lib/Epub/Epub/ParsedText.cpp | 7 ++----- .../Epub/hyphenation/EnglishHyphenator.cpp | 19 ++++++++++++++----- .../Epub/hyphenation/HyphenationCommon.cpp | 4 +--- lib/Epub/Epub/hyphenation/Hyphenator.cpp | 7 +++---- .../Epub/hyphenation/RussianHyphenator.cpp | 7 ++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/Epub/Epub/ParsedText.cpp b/lib/Epub/Epub/ParsedText.cpp index 4d6386b..92a6f21 100644 --- a/lib/Epub/Epub/ParsedText.cpp +++ b/lib/Epub/Epub/ParsedText.cpp @@ -36,9 +36,7 @@ void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fo const bool allowIndent = !extraParagraphSpacing && (style == TextBlock::JUSTIFIED || style == TextBlock::LEFT_ALIGN); const int indentWidth = allowIndent ? renderer.getTextWidth(fontId, "m", REGULAR) : 0; const int firstLinePageWidth = allowIndent ? std::max(pageWidth - indentWidth, 0) : pageWidth; - auto pageWidthForLine = [&](const bool isFirstLine) -> int { - return isFirstLine ? firstLinePageWidth : pageWidth; - }; + auto pageWidthForLine = [&](const bool isFirstLine) -> int { return isFirstLine ? firstLinePageWidth : pageWidth; }; auto wordIt = words.begin(); auto styleIt = wordStyles.begin(); @@ -110,8 +108,7 @@ void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fo } } - processLine( - std::make_shared(std::move(lineWords), std::move(lineXPos), std::move(lineStyles), style)); + processLine(std::make_shared(std::move(lineWords), std::move(lineXPos), std::move(lineStyles), style)); producedLines++; lineWordWidths.clear(); diff --git a/lib/Epub/Epub/hyphenation/EnglishHyphenator.cpp b/lib/Epub/Epub/hyphenation/EnglishHyphenator.cpp index e4f79d0..7f2d3d2 100644 --- a/lib/Epub/Epub/hyphenation/EnglishHyphenator.cpp +++ b/lib/Epub/Epub/hyphenation/EnglishHyphenator.cpp @@ -88,8 +88,18 @@ bool isValidEnglishOnsetBigram(const uint32_t firstCp, const uint32_t secondCp) } if (matchesDigraph(first, second, - {{'c', 'h'}, {'s', 'h'}, {'t', 'h'}, {'p', 'h'}, {'w', 'h'}, {'w', 'r'}, {'k', 'n'}, - {'g', 'n'}, {'p', 's'}, {'p', 't'}, {'p', 'n'}, {'r', 'h'}})) { + {{'c', 'h'}, + {'s', 'h'}, + {'t', 'h'}, + {'p', 'h'}, + {'w', 'h'}, + {'w', 'r'}, + {'k', 'n'}, + {'g', 'n'}, + {'p', 's'}, + {'p', 't'}, + {'p', 'n'}, + {'r', 'h'}})) { return true; } @@ -228,9 +238,8 @@ std::vector englishBreakIndexes(const std::vector& cps) { const size_t rightVowel = vowelPositions[v + 1]; if (rightVowel - leftVowel == 1) { - if (!isEnglishDiphthong(cps[leftVowel].value, cps[rightVowel].value) && - rightVowel >= MIN_PREFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && - !nextToApostrophe(cps, rightVowel)) { + if (!isEnglishDiphthong(cps[leftVowel].value, cps[rightVowel].value) && rightVowel >= MIN_PREFIX_CP && + cps.size() - rightVowel >= MIN_SUFFIX_CP && !nextToApostrophe(cps, rightVowel)) { indexes.push_back(rightVowel); } continue; diff --git a/lib/Epub/Epub/hyphenation/HyphenationCommon.cpp b/lib/Epub/Epub/hyphenation/HyphenationCommon.cpp index 64b11e8..34b1f3c 100644 --- a/lib/Epub/Epub/hyphenation/HyphenationCommon.cpp +++ b/lib/Epub/Epub/hyphenation/HyphenationCommon.cpp @@ -25,9 +25,7 @@ uint32_t toLowerLatin(const uint32_t cp) { return toLowerLatinImpl(cp); } uint32_t toLowerCyrillic(const uint32_t cp) { return toLowerCyrillicImpl(cp); } -bool isLatinLetter(const uint32_t cp) { - return (cp >= 'A' && cp <= 'Z') || (cp >= 'a' && cp <= 'z'); -} +bool isLatinLetter(const uint32_t cp) { return (cp >= 'A' && cp <= 'Z') || (cp >= 'a' && cp <= 'z'); } bool isLatinVowel(uint32_t cp) { cp = toLowerLatinImpl(cp); diff --git a/lib/Epub/Epub/hyphenation/Hyphenator.cpp b/lib/Epub/Epub/hyphenation/Hyphenator.cpp index ef5231c..5a6b22e 100644 --- a/lib/Epub/Epub/hyphenation/Hyphenator.cpp +++ b/lib/Epub/Epub/hyphenation/Hyphenator.cpp @@ -1,14 +1,13 @@ #include "Hyphenator.h" #include +#include #include #include #include #include -#include - #include "EnglishHyphenator.h" #include "HyphenationCommon.h" #include "LanguageHyphenator.h" @@ -80,8 +79,8 @@ std::vector fallbackBreakIndexes(const std::vector& cps) const bool prevConsonant = !prevVowel; const bool currConsonant = !currVowel; - const bool breakable = (prevVowel && currConsonant) || (prevConsonant && currConsonant) || - (prevConsonant && currVowel); + const bool breakable = + (prevVowel && currConsonant) || (prevConsonant && currConsonant) || (prevConsonant && currVowel); if (breakable) { indexes.push_back(i); diff --git a/lib/Epub/Epub/hyphenation/RussianHyphenator.cpp b/lib/Epub/Epub/hyphenation/RussianHyphenator.cpp index 1af669e..b37ebc6 100644 --- a/lib/Epub/Epub/hyphenation/RussianHyphenator.cpp +++ b/lib/Epub/Epub/hyphenation/RussianHyphenator.cpp @@ -5,9 +5,7 @@ namespace { -bool isSoftOrHardSign(const uint32_t cp) { - return cp == 0x044C || cp == 0x042C || cp == 0x044A || cp == 0x042A; -} +bool isSoftOrHardSign(const uint32_t cp) { return cp == 0x044C || cp == 0x042C || cp == 0x044A || cp == 0x042A; } bool isRussianPrefixConsonant(uint32_t cp) { cp = toLowerCyrillic(cp); @@ -162,8 +160,7 @@ std::vector russianBreakIndexes(const std::vector& cps) { const size_t rightVowel = vowelPositions[v + 1]; if (rightVowel - leftVowel == 1) { - if (rightVowel >= MIN_PREFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && - !nextToSoftSign(cps, rightVowel)) { + if (rightVowel >= MIN_PREFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && !nextToSoftSign(cps, rightVowel)) { indexes.push_back(rightVowel); } continue;