1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

fixed empty line support in <pre>-formatted text

This commit is contained in:
Nikolay Pultsin 2014-06-04 18:28:45 +01:00
parent 0256b78bf6
commit 995872c344
3 changed files with 7 additions and 2 deletions

View file

@ -3,6 +3,7 @@
* better cover detection for ePubs * better cover detection for ePubs
* Arabic FBReaderJ resources, by Ahmed Saidi (https://github.com/boussouira) * Arabic FBReaderJ resources, by Ahmed Saidi (https://github.com/boussouira)
* Updated German localization (by Matthias Dill) * Updated German localization (by Matthias Dill)
* ePub: fixed empty line support in <pre>-formatted text
===== 1.10.2 (May 25, 2014) ===== ===== 1.10.2 (May 25, 2014) =====
* Fixed local library duplicates issue * Fixed local library duplicates issue

View file

@ -314,7 +314,7 @@ void XHTMLTagBodyAction::doAtEnd(XHTMLReader &reader) {
void XHTMLTagRestartParagraphAction::doAtStart(XHTMLReader &reader, const char**) { void XHTMLTagRestartParagraphAction::doAtStart(XHTMLReader &reader, const char**) {
if (reader.myCurrentParagraphIsEmpty) { if (reader.myCurrentParagraphIsEmpty) {
bookReader(reader).addData(" "); bookReader(reader).addFixedHSpace(1);
} }
endParagraph(reader); endParagraph(reader);
beginParagraph(reader); beginParagraph(reader);
@ -842,6 +842,9 @@ void XHTMLReader::characterDataHandler(const char *text, std::size_t len) {
case XHTML_READ_BODY: case XHTML_READ_BODY:
if (myPreformatted) { if (myPreformatted) {
if (*text == '\r' || *text == '\n') { if (*text == '\r' || *text == '\n') {
if (myCurrentParagraphIsEmpty) {
myModelReader.addFixedHSpace(1);
}
endParagraph(); endParagraph();
text += 1; text += 1;
len -= 1; len -= 1;

View file

@ -212,7 +212,8 @@ abstract class ZLTextViewBase extends ZLView {
} }
final int getElementHeight(ZLTextElement element) { final int getElementHeight(ZLTextElement element) {
if (element instanceof ZLTextWord) { if (element instanceof ZLTextWord ||
element instanceof ZLTextFixedHSpaceElement) {
return getWordHeight(); return getWordHeight();
} else if (element instanceof ZLTextImageElement) { } else if (element instanceof ZLTextImageElement) {
final ZLTextImageElement imageElement = (ZLTextImageElement)element; final ZLTextImageElement imageElement = (ZLTextImageElement)element;