mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 07:37:41 +03:00
clang format fix
This commit is contained in:
parent
26b84b38a2
commit
13a6c43b87
@ -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<TextBlock>(std::move(lineWords), std::move(lineXPos), std::move(lineStyles), style));
|
||||
processLine(std::make_shared<TextBlock>(std::move(lineWords), std::move(lineXPos), std::move(lineStyles), style));
|
||||
|
||||
producedLines++;
|
||||
lineWordWidths.clear();
|
||||
|
||||
@ -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<size_t> englishBreakIndexes(const std::vector<CodepointInfo>& 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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
#include "Hyphenator.h"
|
||||
|
||||
#include <GfxRenderer.h>
|
||||
#include <Utf8.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
#include <Utf8.h>
|
||||
|
||||
#include "EnglishHyphenator.h"
|
||||
#include "HyphenationCommon.h"
|
||||
#include "LanguageHyphenator.h"
|
||||
@ -80,8 +79,8 @@ std::vector<size_t> fallbackBreakIndexes(const std::vector<CodepointInfo>& 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);
|
||||
|
||||
@ -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<size_t> russianBreakIndexes(const std::vector<CodepointInfo>& 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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user