clang format fix

This commit is contained in:
Arthur Tazhitdinov 2025-12-17 18:24:09 +03:00
parent 26b84b38a2
commit 13a6c43b87
5 changed files with 22 additions and 22 deletions

View File

@ -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 bool allowIndent = !extraParagraphSpacing && (style == TextBlock::JUSTIFIED || style == TextBlock::LEFT_ALIGN);
const int indentWidth = allowIndent ? renderer.getTextWidth(fontId, "m", REGULAR) : 0; const int indentWidth = allowIndent ? renderer.getTextWidth(fontId, "m", REGULAR) : 0;
const int firstLinePageWidth = allowIndent ? std::max(pageWidth - indentWidth, 0) : pageWidth; const int firstLinePageWidth = allowIndent ? std::max(pageWidth - indentWidth, 0) : pageWidth;
auto pageWidthForLine = [&](const bool isFirstLine) -> int { auto pageWidthForLine = [&](const bool isFirstLine) -> int { return isFirstLine ? firstLinePageWidth : pageWidth; };
return isFirstLine ? firstLinePageWidth : pageWidth;
};
auto wordIt = words.begin(); auto wordIt = words.begin();
auto styleIt = wordStyles.begin(); auto styleIt = wordStyles.begin();
@ -110,8 +108,7 @@ void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fo
} }
} }
processLine( processLine(std::make_shared<TextBlock>(std::move(lineWords), std::move(lineXPos), std::move(lineStyles), style));
std::make_shared<TextBlock>(std::move(lineWords), std::move(lineXPos), std::move(lineStyles), style));
producedLines++; producedLines++;
lineWordWidths.clear(); lineWordWidths.clear();

View File

@ -88,8 +88,18 @@ bool isValidEnglishOnsetBigram(const uint32_t firstCp, const uint32_t secondCp)
} }
if (matchesDigraph(first, second, if (matchesDigraph(first, second,
{{'c', 'h'}, {'s', 'h'}, {'t', 'h'}, {'p', 'h'}, {'w', 'h'}, {'w', 'r'}, {'k', 'n'}, {{'c', 'h'},
{'g', 'n'}, {'p', 's'}, {'p', 't'}, {'p', 'n'}, {'r', '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; return true;
} }
@ -228,9 +238,8 @@ std::vector<size_t> englishBreakIndexes(const std::vector<CodepointInfo>& cps) {
const size_t rightVowel = vowelPositions[v + 1]; const size_t rightVowel = vowelPositions[v + 1];
if (rightVowel - leftVowel == 1) { if (rightVowel - leftVowel == 1) {
if (!isEnglishDiphthong(cps[leftVowel].value, cps[rightVowel].value) && if (!isEnglishDiphthong(cps[leftVowel].value, cps[rightVowel].value) && rightVowel >= MIN_PREFIX_CP &&
rightVowel >= MIN_PREFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && !nextToApostrophe(cps, rightVowel)) {
!nextToApostrophe(cps, rightVowel)) {
indexes.push_back(rightVowel); indexes.push_back(rightVowel);
} }
continue; continue;

View File

@ -25,9 +25,7 @@ uint32_t toLowerLatin(const uint32_t cp) { return toLowerLatinImpl(cp); }
uint32_t toLowerCyrillic(const uint32_t cp) { return toLowerCyrillicImpl(cp); } uint32_t toLowerCyrillic(const uint32_t cp) { return toLowerCyrillicImpl(cp); }
bool isLatinLetter(const uint32_t cp) { bool isLatinLetter(const uint32_t cp) { return (cp >= 'A' && cp <= 'Z') || (cp >= 'a' && cp <= 'z'); }
return (cp >= 'A' && cp <= 'Z') || (cp >= 'a' && cp <= 'z');
}
bool isLatinVowel(uint32_t cp) { bool isLatinVowel(uint32_t cp) {
cp = toLowerLatinImpl(cp); cp = toLowerLatinImpl(cp);

View File

@ -1,14 +1,13 @@
#include "Hyphenator.h" #include "Hyphenator.h"
#include <GfxRenderer.h> #include <GfxRenderer.h>
#include <Utf8.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <limits> #include <limits>
#include <vector> #include <vector>
#include <Utf8.h>
#include "EnglishHyphenator.h" #include "EnglishHyphenator.h"
#include "HyphenationCommon.h" #include "HyphenationCommon.h"
#include "LanguageHyphenator.h" #include "LanguageHyphenator.h"
@ -80,8 +79,8 @@ std::vector<size_t> fallbackBreakIndexes(const std::vector<CodepointInfo>& cps)
const bool prevConsonant = !prevVowel; const bool prevConsonant = !prevVowel;
const bool currConsonant = !currVowel; const bool currConsonant = !currVowel;
const bool breakable = (prevVowel && currConsonant) || (prevConsonant && currConsonant) || const bool breakable =
(prevConsonant && currVowel); (prevVowel && currConsonant) || (prevConsonant && currConsonant) || (prevConsonant && currVowel);
if (breakable) { if (breakable) {
indexes.push_back(i); indexes.push_back(i);

View File

@ -5,9 +5,7 @@
namespace { namespace {
bool isSoftOrHardSign(const uint32_t cp) { bool isSoftOrHardSign(const uint32_t cp) { return cp == 0x044C || cp == 0x042C || cp == 0x044A || cp == 0x042A; }
return cp == 0x044C || cp == 0x042C || cp == 0x044A || cp == 0x042A;
}
bool isRussianPrefixConsonant(uint32_t cp) { bool isRussianPrefixConsonant(uint32_t cp) {
cp = toLowerCyrillic(cp); cp = toLowerCyrillic(cp);
@ -162,8 +160,7 @@ std::vector<size_t> russianBreakIndexes(const std::vector<CodepointInfo>& cps) {
const size_t rightVowel = vowelPositions[v + 1]; const size_t rightVowel = vowelPositions[v + 1];
if (rightVowel - leftVowel == 1) { if (rightVowel - leftVowel == 1) {
if (rightVowel >= MIN_PREFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && if (rightVowel >= MIN_PREFIX_CP && cps.size() - rightVowel >= MIN_SUFFIX_CP && !nextToSoftSign(cps, rightVowel)) {
!nextToSoftSign(cps, rightVowel)) {
indexes.push_back(rightVowel); indexes.push_back(rightVowel);
} }
continue; continue;