From 24d594e9bc87dc7163600da86a587a708c93c5a8 Mon Sep 17 00:00:00 2001 From: griffon Date: Wed, 21 Nov 2007 22:52:55 +0000 Subject: [PATCH] Now using descent correctly while displaying lines Started implementing decorations git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@180 6a642e6f-84f6-412e-ac94-c4a38d5a04b0 --- .../text/view/impl/ZLTextViewImpl.java | 16 +++++-- .../text/view/style/ZLTextBaseStyle.class | Bin 0 -> 851 bytes .../text/view/style/ZLTextDecoratedStyle.java | 4 ++ .../view/style/ZLTextFullDecoratedStyle.java | 5 +++ .../view/style/ZLTextFullStyleDecoration.java | 32 ++++++++++++++ .../view/style/ZLTextStyleDecoration.java | 39 ++++++++++++++++++ 6 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 src/org/zlibrary/text/view/style/ZLTextBaseStyle.class create mode 100644 src/org/zlibrary/text/view/style/ZLTextDecoratedStyle.java create mode 100644 src/org/zlibrary/text/view/style/ZLTextFullDecoratedStyle.java create mode 100644 src/org/zlibrary/text/view/style/ZLTextFullStyleDecoration.java create mode 100644 src/org/zlibrary/text/view/style/ZLTextStyleDecoration.java diff --git a/src/org/zlibrary/text/view/impl/ZLTextViewImpl.java b/src/org/zlibrary/text/view/impl/ZLTextViewImpl.java index 8ec5f9961..24fa5958a 100644 --- a/src/org/zlibrary/text/view/impl/ZLTextViewImpl.java +++ b/src/org/zlibrary/text/view/impl/ZLTextViewImpl.java @@ -36,10 +36,18 @@ public class ZLTextViewImpl extends ZLTextView { myContext.setFont(myStyle.fontFamily(), myStyle.fontSize(), myStyle.bold(), myStyle.italic()); } -/* public void applyControl(ZLTextControlElement control) { - } + public void applyControl(ZLTextControlElement control) { +/* if (control.isStart()) { + ZLTextStyleDecoration decoration = new ZLTextStyleDecoration(control.getEntry()); + setStyle(decoration.createDecoratedStyle(myStyle)); + } else { + if (myStyle.isDecorated()) { + setStyle(((ZLTextDecoratedStyle) myStyle).base()); + } + } +*/ } + -*/ public ZLPaintContext getPaintContext() { return myContext; } @@ -146,7 +154,7 @@ public class ZLTextViewImpl extends ZLTextView { w += dw; } } - h += info.Height; + h += info.Height + info.Descent; } } diff --git a/src/org/zlibrary/text/view/style/ZLTextBaseStyle.class b/src/org/zlibrary/text/view/style/ZLTextBaseStyle.class new file mode 100644 index 0000000000000000000000000000000000000000..9efbeec003c1b45219533feb1acfea933d31c196 GIT binary patch literal 851 zcma)(&q~8U5XNU4ZE9>a+WOxr>cLjU;8_t=5QL(Kh=<-b=_Xy-CbC_t?K64MliVSM>$k*P9k04`u>(*zXm4u?(Go;GU$i?3#h7?3Fh&gS0FF= zL0|%7{=10LN*Xk}f=Z*tZ03^S2VBOi9dkyO(}X<&S4M6o v9X#A`0lC=`IDKO|<T+!$n+|^x literal 0 HcmV?d00001 diff --git a/src/org/zlibrary/text/view/style/ZLTextDecoratedStyle.java b/src/org/zlibrary/text/view/style/ZLTextDecoratedStyle.java new file mode 100644 index 000000000..a6c160533 --- /dev/null +++ b/src/org/zlibrary/text/view/style/ZLTextDecoratedStyle.java @@ -0,0 +1,4 @@ +package org.zlibrary.text.view.style; + +public class ZLTextDecoratedStyle { +} diff --git a/src/org/zlibrary/text/view/style/ZLTextFullDecoratedStyle.java b/src/org/zlibrary/text/view/style/ZLTextFullDecoratedStyle.java new file mode 100644 index 000000000..d3c1c3f70 --- /dev/null +++ b/src/org/zlibrary/text/view/style/ZLTextFullDecoratedStyle.java @@ -0,0 +1,5 @@ +package org.zlibrary.text.view.style; + +public class ZLTextFullDecoratedStyle { + +} diff --git a/src/org/zlibrary/text/view/style/ZLTextFullStyleDecoration.java b/src/org/zlibrary/text/view/style/ZLTextFullStyleDecoration.java new file mode 100644 index 000000000..845d06f8a --- /dev/null +++ b/src/org/zlibrary/text/view/style/ZLTextFullStyleDecoration.java @@ -0,0 +1,32 @@ +package org.zlibrary.text.view.style; + +import org.zlibrary.options.*; +import org.zlibrary.options.util.*; + +import org.zlibrary.text.view.ZLTextStyle; + +import org.zlibrary.text.model.ZLTextAlignmentType; + +public class ZLTextFullStyleDecoration extends ZLTextStyleDecoration { + public ZLIntegerRangeOption SpaceBeforeOption; + public ZLIntegerRangeOption SpaceAfterOption; + public ZLIntegerRangeOption LeftIndentOption; + public ZLIntegerRangeOption RightIndentOption; + public ZLIntegerRangeOption FirstLineIndentDeltaOption; + + public ZLIntegerOption AlignmentOption; + + public ZLDoubleOption LineSpaceOption; + + public ZLTextFullStyleDecoration(String name, int fontSizeDelta, ZLBoolean3 bold, ZLBoolean3 italic, int spaceBefore, int spaceAfter, int leftIndent,int rightIndent, int firstLineDelta, int verticalShift, ZLTextAlignmentType alignment, double lineSpace, ZLBoolean3 allowHyphenations) { + super(name, fontSizeDelta, bold, italic, verticalShift, allowHyphenations); + } + + public boolean isFullDecoration() { + return true; + } + +// public ZLTextStyle createDecoratedStyle(ZLTextStyle base) { +// +// } +} diff --git a/src/org/zlibrary/text/view/style/ZLTextStyleDecoration.java b/src/org/zlibrary/text/view/style/ZLTextStyleDecoration.java new file mode 100644 index 000000000..f140bde92 --- /dev/null +++ b/src/org/zlibrary/text/view/style/ZLTextStyleDecoration.java @@ -0,0 +1,39 @@ +package org.zlibrary.text.view.style; + +import org.zlibrary.options.util.*; +import org.zlibrary.options.*; + +import org.zlibrary.text.view.ZLTextStyle; + + +public class ZLTextStyleDecoration { + public static final String STYLE = "Style"; + + public ZLStringOption FontFamilyOption; + public ZLIntegerRangeOption FontSizeDeltaOption; + public ZLBoolean3Option BoldOption; + public ZLBoolean3Option ItalicOption; + + private String myName; + + public ZLIntegerOption VerticalShiftOption; + + public ZLBoolean3Option AllowHyphenationsOption; + + public ZLTextStyleDecoration(String name, int fontSizeDelta, ZLBoolean3 bold, ZLBoolean3 italic, int verticalShift, ZLBoolean3 allowHyphenations) { + FontFamilyOption = null; + FontSizeDeltaOption = null; + BoldOption = new ZLBoolean3Option(ZLOption.LOOK_AND_FEEL_CATEGORY, STYLE, name + ":bold", bold); + ItalicOption = null; + VerticalShiftOption = null; + AllowHyphenationsOption = null; + } + + public boolean isFullDecoration() { + return false; + } + + public String getName() { + return myName; + } +}