@@ -8,6 +8,7 @@
|
|||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
static_assert(sizeof(EpdGlyph) == 16, "EpdGlyph must be 16 bytes to match .cpfont file layout");
|
static_assert(sizeof(EpdGlyph) == 16, "EpdGlyph must be 16 bytes to match .cpfont file layout");
|
||||||
static_assert(sizeof(EpdUnicodeInterval) == 12, "EpdUnicodeInterval must be 12 bytes to match .cpfont file layout");
|
static_assert(sizeof(EpdUnicodeInterval) == 12, "EpdUnicodeInterval must be 12 bytes to match .cpfont file layout");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include "EpdFont.h"
|
#include "EpdFont.h"
|
||||||
#include "EpdFontData.h"
|
#include "EpdFontData.h"
|
||||||
|
|||||||
@@ -1785,14 +1785,44 @@ bool EpubReaderActivity::drawCurrentPageToBuffer(const std::string& filePath, Gf
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int effectiveFontId = getEffectiveFontId(effectiveFontFamily, effectiveFontSize);
|
||||||
|
const auto getEffectiveLineCompression = [&](int fontId) {
|
||||||
|
const int notosansId = CrossPointSettings::getBuiltinReaderFontId(CrossPointSettings::NOTOSANS, effectiveFontSize);
|
||||||
|
const int opendyslexicId =
|
||||||
|
CrossPointSettings::getBuiltinReaderFontId(CrossPointSettings::OPENDYSLEXIC, effectiveFontSize);
|
||||||
|
|
||||||
|
if (fontId == notosansId || fontId == opendyslexicId) {
|
||||||
|
switch (SETTINGS.lineSpacing) {
|
||||||
|
case CrossPointSettings::TIGHT:
|
||||||
|
return 0.90f;
|
||||||
|
case CrossPointSettings::NORMAL:
|
||||||
|
default:
|
||||||
|
return 0.95f;
|
||||||
|
case CrossPointSettings::WIDE:
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (SETTINGS.lineSpacing) {
|
||||||
|
case CrossPointSettings::TIGHT:
|
||||||
|
return 0.95f;
|
||||||
|
case CrossPointSettings::NORMAL:
|
||||||
|
default:
|
||||||
|
return 1.0f;
|
||||||
|
case CrossPointSettings::WIDE:
|
||||||
|
return 1.1f;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const float effectiveLineCompression = getEffectiveLineCompression(effectiveFontId);
|
||||||
auto section = std::make_unique<Section>(epub, spineIndex, renderer);
|
auto section = std::make_unique<Section>(epub, spineIndex, renderer);
|
||||||
if (!section->loadSectionFile(getEffectiveFontId(effectiveFontFamily, effectiveFontSize),
|
if (!section->loadSectionFile(getEffectiveFontId(effectiveFontFamily, effectiveFontSize), effectiveLineCompression,
|
||||||
getEffectiveReaderLineCompression(), SETTINGS.extraParagraphSpacing,
|
SETTINGS.extraParagraphSpacing, SETTINGS.paragraphAlignment, viewportWidth,
|
||||||
SETTINGS.paragraphAlignment, viewportWidth, viewportHeight, SETTINGS.hyphenationEnabled,
|
viewportHeight, SETTINGS.hyphenationEnabled, SETTINGS.embeddedStyle,
|
||||||
SETTINGS.embeddedStyle, SETTINGS.imageRendering)) {
|
SETTINGS.imageRendering)) {
|
||||||
LOG_DBG("SLP", "EPUB: section cache not found for spine %d, rebuilding", spineIndex);
|
LOG_DBG("SLP", "EPUB: section cache not found for spine %d, rebuilding", spineIndex);
|
||||||
if (!section->createSectionFile(getEffectiveFontId(effectiveFontFamily, effectiveFontSize),
|
if (!section->createSectionFile(getEffectiveFontId(effectiveFontFamily, effectiveFontSize),
|
||||||
getEffectiveReaderLineCompression(), SETTINGS.extraParagraphSpacing,
|
effectiveLineCompression, SETTINGS.extraParagraphSpacing,
|
||||||
SETTINGS.paragraphAlignment, viewportWidth, viewportHeight,
|
SETTINGS.paragraphAlignment, viewportWidth, viewportHeight,
|
||||||
SETTINGS.hyphenationEnabled, SETTINGS.embeddedStyle, SETTINGS.imageRendering)) {
|
SETTINGS.hyphenationEnabled, SETTINGS.embeddedStyle, SETTINGS.imageRendering)) {
|
||||||
LOG_ERR("SLP", "EPUB: failed to rebuild section cache for spine %d", spineIndex);
|
LOG_ERR("SLP", "EPUB: failed to rebuild section cache for spine %d", spineIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user