mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
fixed width NBSP
This commit is contained in:
parent
bc49e05545
commit
354f3f4925
2 changed files with 3 additions and 11 deletions
|
@ -883,13 +883,6 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
((ExtensionElement)element).draw(context, area);
|
((ExtensionElement)element).draw(context, area);
|
||||||
} else if (element == ZLTextElement.HSpace || element == ZLTextElement.NBSpace) {
|
} else if (element == ZLTextElement.HSpace || element == ZLTextElement.NBSpace) {
|
||||||
final int cw = context.getSpaceWidth();
|
final int cw = context.getSpaceWidth();
|
||||||
/*
|
|
||||||
context.setFillColor(getHighlightingColor());
|
|
||||||
context.fillRectangle(
|
|
||||||
area.XStart, areaY - context.getStringHeight(),
|
|
||||||
area.XEnd - 1, areaY + context.getDescent()
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
for (int len = 0; len < area.XEnd - area.XStart; len += cw) {
|
for (int len = 0; len < area.XEnd - area.XStart; len += cw) {
|
||||||
context.drawString(areaX + len, areaY, SPACE, 0, 1);
|
context.drawString(areaX + len, areaY, SPACE, 0, 1);
|
||||||
}
|
}
|
||||||
|
@ -1093,9 +1086,6 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
}
|
}
|
||||||
} else if (element == ZLTextElement.NBSpace) {
|
} else if (element == ZLTextElement.NBSpace) {
|
||||||
wordOccurred = true;
|
wordOccurred = true;
|
||||||
internalSpaceCounter++;
|
|
||||||
lastSpaceWidth = context.getSpaceWidth();
|
|
||||||
newWidth += lastSpaceWidth;
|
|
||||||
} else if (element instanceof ZLTextWord) {
|
} else if (element instanceof ZLTextWord) {
|
||||||
wordOccurred = true;
|
wordOccurred = true;
|
||||||
isVisible = true;
|
isVisible = true;
|
||||||
|
@ -1290,7 +1280,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
for (int wordIndex = info.RealStartElementIndex; wordIndex != endElementIndex; ++wordIndex, charIndex = 0) {
|
for (int wordIndex = info.RealStartElementIndex; wordIndex != endElementIndex; ++wordIndex, charIndex = 0) {
|
||||||
final ZLTextElement element = paragraph.getElement(wordIndex);
|
final ZLTextElement element = paragraph.getElement(wordIndex);
|
||||||
final int width = getElementWidth(element, charIndex);
|
final int width = getElementWidth(element, charIndex);
|
||||||
if (element == ZLTextElement.HSpace || element == ZLTextElement.NBSpace) {
|
if (element == ZLTextElement.HSpace) {
|
||||||
if (wordOccurred && spaceCounter > 0) {
|
if (wordOccurred && spaceCounter > 0) {
|
||||||
final int correction = fullCorrection / spaceCounter;
|
final int correction = fullCorrection / spaceCounter;
|
||||||
final int spaceLength = context.getSpaceWidth() + correction;
|
final int spaceLength = context.getSpaceWidth() + correction;
|
||||||
|
|
|
@ -216,6 +216,8 @@ abstract class ZLTextViewBase extends ZLView {
|
||||||
return Math.min(300, getTextColumnWidth());
|
return Math.min(300, getTextColumnWidth());
|
||||||
} else if (element instanceof ExtensionElement) {
|
} else if (element instanceof ExtensionElement) {
|
||||||
return ((ExtensionElement)element).getWidth();
|
return ((ExtensionElement)element).getWidth();
|
||||||
|
} else if (element == ZLTextElement.NBSpace) {
|
||||||
|
return getContext().getSpaceWidth();
|
||||||
} else if (element == ZLTextElement.Indent) {
|
} else if (element == ZLTextElement.Indent) {
|
||||||
return myTextStyle.getFirstLineIndent(metrics());
|
return myTextStyle.getFirstLineIndent(metrics());
|
||||||
} else if (element instanceof ZLTextFixedHSpaceElement) {
|
} else if (element instanceof ZLTextFixedHSpaceElement) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue