aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-07-18 15:03:47 +0000
committerJeremias Maerki <jeremias@apache.org>2005-07-18 15:03:47 +0000
commit7bf1e40ebb2a705544492cc1ca21b4444f4168af (patch)
treeda4650c431ebb9fd17b95dcf997501ed802466aa /src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
parentbaad0905d66552f02ce9e920945b58314017fda1 (diff)
downloadxmlgraphics-fop-7bf1e40ebb2a705544492cc1ca21b4444f4168af.tar.gz
xmlgraphics-fop-7bf1e40ebb2a705544492cc1ca21b4444f4168af.zip
Moved inline-level LMs and support classes to "inline" subpackage.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@219509 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/inline/HyphContext.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/HyphContext.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java b/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
new file mode 100644
index 000000000..86e8ba48a
--- /dev/null
+++ b/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr.inline;
+
+/**
+ * This class is used to pass information to the getNextBreakPoss()
+ * method concerning hyphenation. A reference to an instance of the
+ * class is contained in the LayoutContext object passed to each
+ * LayoutManager. It contains information concerning the hyphenation
+ * points in a word and the how many of those have previously been
+ * processed by a Layout Manager to generate size information.
+ */
+public class HyphContext {
+ private int[] hyphPoints;
+ private int currentOffset = 0;
+ private int currentIndex = 0;
+
+ public HyphContext(int[] hyphPoints) {
+ this.hyphPoints = hyphPoints;
+ }
+
+ public int getNextHyphPoint() {
+ for (; currentIndex < hyphPoints.length; currentIndex++) {
+ if (hyphPoints[currentIndex] > currentOffset) {
+ return (hyphPoints[currentIndex] - currentOffset);
+ }
+ }
+ return -1; // AT END!
+ }
+
+ public boolean hasMoreHyphPoints() {
+ for (; currentIndex < hyphPoints.length; currentIndex++) {
+ if (hyphPoints[currentIndex] > currentOffset) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void updateOffset(int iCharsProcessed) {
+ currentOffset += iCharsProcessed;
+ }
+}