conflicts with org.w3c.dom.Text) changed Renderer.renderWord() method to renderText(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196973 13f79535-47bb-0310-9956-ffa450edef68tags/Root_Temp_KnuthStylePageBreaking
@@ -66,11 +66,11 @@ public interface InlineAreaVisitor { | |||
void serveVisitor(Viewport viewport); | |||
/** | |||
* Handle a visitor request to process an inline word. | |||
* Handle a visitor request to process inline text. | |||
* | |||
* @param area The word area | |||
* @param area The text area | |||
*/ | |||
void serveVisitor(Word area); | |||
void serveVisitor(TextArea area); | |||
/** | |||
* Handle a visitor request to process an inline parent area. |
@@ -1,5 +1,5 @@ | |||
/* | |||
* $Id: Word.java,v 1.10 2003/03/05 16:45:42 jeremias Exp $ | |||
* $Id$ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
@@ -51,21 +51,20 @@ | |||
package org.apache.fop.area.inline; | |||
/** | |||
* A word inline area. | |||
* This is really a collection character inline areas collected together | |||
* into a single word. | |||
* A text inline area. | |||
*/ | |||
public class Word extends InlineArea { | |||
public class TextArea extends InlineArea { | |||
/** | |||
* The word for this word area. | |||
* The text for this inline area | |||
*/ | |||
protected String word; | |||
private int iWSadjust = 0; | |||
protected String text; | |||
private int iTSadjust = 0; | |||
/** | |||
* Create a word area. | |||
* Create a text inline area | |||
*/ | |||
public Word() { | |||
public TextArea() { | |||
} | |||
/** | |||
@@ -79,39 +78,39 @@ public class Word extends InlineArea { | |||
} | |||
/** | |||
* Set the word. | |||
* Set the text string | |||
* | |||
* @param w the word string | |||
* @param t the text string | |||
*/ | |||
public void setWord(String w) { | |||
word = w; | |||
public void setTextArea(String t) { | |||
text = t; | |||
} | |||
/** | |||
* Get the word string. | |||
* Get the text string. | |||
* | |||
* @return the word string | |||
* @return the text string | |||
*/ | |||
public String getWord() { | |||
return word; | |||
public String getTextArea() { | |||
return text; | |||
} | |||
/** | |||
* Get word space adjust. | |||
* Get text space adjust. | |||
* | |||
* @return the word space adjustment | |||
* @return the text space adjustment | |||
*/ | |||
public int getWSadjust() { | |||
return iWSadjust; | |||
public int getTSadjust() { | |||
return iTSadjust; | |||
} | |||
/** | |||
* Set word space adjust. | |||
* Set text space adjust. | |||
* | |||
* @param iWSadjust the word space adjustment | |||
* @param iTSadjust the text space adjustment | |||
*/ | |||
public void setWSadjust(int iWSadjust) { | |||
this.iWSadjust = iWSadjust; | |||
public void setTSadjust(int iTSadjust) { | |||
this.iTSadjust = iTSadjust; | |||
} | |||
} | |||
@@ -60,7 +60,7 @@ import java.util.List; | |||
* This is a word area that resolves itself to a page number | |||
* from an id reference. | |||
*/ | |||
public class UnresolvedPageNumber extends Word implements Resolveable { | |||
public class UnresolvedPageNumber extends TextArea implements Resolveable { | |||
private boolean resolved = false; | |||
private String pageRefId; | |||
@@ -71,7 +71,7 @@ public class UnresolvedPageNumber extends Word implements Resolveable { | |||
*/ | |||
public UnresolvedPageNumber(String id) { | |||
pageRefId = id; | |||
word = "?"; | |||
text = "?"; | |||
} | |||
/** | |||
@@ -98,7 +98,7 @@ public class UnresolvedPageNumber extends Word implements Resolveable { | |||
if (pages != null) { | |||
PageViewport page = (PageViewport)pages.get(0); | |||
String str = page.getPageNumber(); | |||
word = str; | |||
text = str; | |||
/**@todo Update IPD ??? */ | |||
} |
@@ -71,7 +71,7 @@ import org.apache.fop.area.inline.InlineParent; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.UnresolvedPageNumber; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.datatypes.Length; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.FOText; | |||
@@ -378,15 +378,15 @@ public class AddLMVisitor implements FOTreeVisitor { | |||
} else if (node.getLeaderPattern() == LeaderPattern.SPACE) { | |||
leaderArea = new Space(); | |||
} else if (node.getLeaderPattern() == LeaderPattern.DOTS) { | |||
Word w = new Word(); | |||
TextArea t = new TextArea(); | |||
char dot = '.'; // userAgent.getLeaderDotCharacter(); | |||
w.setWord("" + dot); | |||
w.addTrait(Trait.FONT_NAME, node.getFontState().getFontName()); | |||
w.addTrait(Trait.FONT_SIZE, | |||
t.setTextArea("" + dot); | |||
t.addTrait(Trait.FONT_NAME, node.getFontState().getFontName()); | |||
t.addTrait(Trait.FONT_SIZE, | |||
new Integer(node.getFontState().getFontSize())); | |||
// set offset of dot within inline parent | |||
w.setOffset(node.getFontState().getAscender()); | |||
t.setOffset(node.getFontState().getAscender()); | |||
int width = node.getFontState().getCharWidth(dot); | |||
Space spacer = null; | |||
if (node.getPatternWidth() > width) { | |||
@@ -396,7 +396,7 @@ public class AddLMVisitor implements FOTreeVisitor { | |||
} | |||
FilledArea fa = new FilledArea(); | |||
fa.setUnitWidth(width); | |||
fa.addChild(w); | |||
fa.addChild(t); | |||
if (spacer != null) { | |||
fa.addChild(spacer); | |||
} | |||
@@ -738,14 +738,14 @@ public class AddLMVisitor implements FOTreeVisitor { | |||
lm = new LeafNodeLayoutManager() { | |||
public InlineArea get(LayoutContext context) { | |||
// get page string from parent, build area | |||
Word inline = new Word(); | |||
TextArea inline = new TextArea(); | |||
String str = parentLM.getCurrentPageNumber(); | |||
int width = 0; | |||
for (int count = 0; count < str.length(); count++) { | |||
width += node.getFontState().getCharWidth( | |||
str.charAt(count)); | |||
} | |||
inline.setWord(str); | |||
inline.setTextArea(str); | |||
inline.setIPD(width); | |||
inline.setHeight(node.getFontState().getAscender() | |||
- node.getFontState().getDescender()); | |||
@@ -808,10 +808,10 @@ public class AddLMVisitor implements FOTreeVisitor { | |||
if (page != null) { | |||
String str = page.getPageNumber(); | |||
// get page string from parent, build area | |||
Word word = new Word(); | |||
inline = word; | |||
TextArea text = new TextArea(); | |||
inline = text; | |||
int width = node.getStringWidth(str); | |||
word.setWord(str); | |||
text.setTextArea(str); | |||
inline.setIPD(width); | |||
inline.setHeight(node.getFontState().getAscender() | |||
- node.getFontState().getDescender()); |
@@ -56,7 +56,7 @@ import org.apache.fop.fo.TextInfo; | |||
import org.apache.fop.traits.SpaceVal; | |||
import org.apache.fop.area.Trait; | |||
import org.apache.fop.area.inline.InlineArea; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.util.CharUtilities; | |||
import org.apache.fop.traits.MinOptMax; | |||
@@ -68,7 +68,7 @@ import org.apache.fop.traits.MinOptMax; | |||
public class TextLayoutManager extends AbstractLayoutManager { | |||
/** | |||
* Store information about each potential word area. | |||
* Store information about each potential text area. | |||
* Index of character which ends the area, IPD of area, including | |||
* any word-space and letter-space. | |||
* Number of word-spaces? | |||
@@ -523,15 +523,15 @@ public class TextLayoutManager extends AbstractLayoutManager { | |||
word = new Space(); | |||
word.setWidth(ai.ipdArea.opt + iAdjust); | |||
} else { | |||
Word w = createWord( | |||
TextArea t = createText( | |||
str, | |||
ai.ipdArea.opt + iAdjust, context.getBaseline()); | |||
if (iWScount > 0) { | |||
//getLogger().error("Adjustment per word-space= " + | |||
// iAdjust / iWScount); | |||
w.setWSadjust(iAdjust / iWScount); | |||
t.setTSadjust(iAdjust / iWScount); | |||
} | |||
word = w; | |||
word = t; | |||
} | |||
if ((chars[iStart] == SPACE || chars[iStart] == NBSPACE) | |||
&& context.getLeadingSpace().hasSpaces()) { | |||
@@ -567,15 +567,15 @@ public class TextLayoutManager extends AbstractLayoutManager { | |||
* @param base the baseline position | |||
* @return the new word area | |||
*/ | |||
protected Word createWord(String str, int width, int base) { | |||
Word curWordArea = new Word(); | |||
protected TextArea createText(String str, int width, int base) { | |||
TextArea curWordArea = new TextArea(); | |||
curWordArea.setWidth(width); | |||
curWordArea.setHeight(textInfo.fs.getAscender() | |||
- textInfo.fs.getDescender()); | |||
curWordArea.setOffset(textInfo.fs.getAscender()); | |||
curWordArea.setOffset(base); | |||
curWordArea.setWord(str); | |||
curWordArea.setTextArea(str); | |||
curWordArea.addTrait(Trait.FONT_NAME, textInfo.fs.getFontName()); | |||
curWordArea.addTrait(Trait.FONT_SIZE, | |||
new Integer(textInfo.fs.getFontSize())); |
@@ -90,7 +90,7 @@ import org.apache.fop.area.inline.InlineParent; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.area.inline.Character; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fo.FOTreeControl; | |||
@@ -260,8 +260,8 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
InlineArea inline = (InlineArea) children.get(count); | |||
if (inline instanceof Character) { | |||
sb.append(((Character) inline).getChar()); | |||
} else if (inline instanceof Word) { | |||
sb.append(((Word) inline).getWord()); | |||
} else if (inline instanceof TextArea) { | |||
sb.append(((TextArea) inline).getTextArea()); | |||
} else if (inline instanceof InlineParent) { | |||
sb.append(convertToString( | |||
((InlineParent) inline).getChildAreas())); | |||
@@ -653,8 +653,8 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
} | |||
/** @see org.apache.fop.render.Renderer */ | |||
public void renderWord(Word word) { | |||
currentBlockIPPosition += word.getWidth(); | |||
public void renderText(TextArea text) { | |||
currentBlockIPPosition += text.getWidth(); | |||
} | |||
/** @see org.apache.fop.render.Renderer */ | |||
@@ -773,15 +773,15 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
} | |||
/** | |||
* Render the specified Word. | |||
* Render the specified Text. | |||
* Required by InlineAreaVisitor interface, which is used to determine which | |||
* InlineArea subclass should be rendered. | |||
* | |||
* @param area The Word area to be rendered | |||
* @param area The Text area to be rendered | |||
* @see org.apache.fop.area.inline.InlineAreaVisitor | |||
*/ | |||
public void serveVisitor(Word area) { | |||
renderWord(area); | |||
public void serveVisitor(TextArea area) { | |||
renderText(area); | |||
} | |||
/** |
@@ -66,7 +66,7 @@ import org.apache.fop.area.inline.InlineParent; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.fo.FOTreeControl; | |||
import org.apache.fop.apps.FOUserAgent; | |||
@@ -227,11 +227,11 @@ public interface Renderer { | |||
void renderContainer(Container cont); | |||
/** | |||
* Tells the renderer to render an inline word. | |||
* Tells the renderer to render an inline text area | |||
* | |||
* @param area The word area | |||
* @param area The text area | |||
*/ | |||
void renderWord(Word area); | |||
void renderText(TextArea area); | |||
/** | |||
* Tells the renderer to render an inline parent area. |
@@ -85,7 +85,7 @@ import org.apache.fop.area.Page; | |||
import org.apache.fop.area.PageViewport; | |||
import org.apache.fop.area.RegionViewport; | |||
import org.apache.fop.area.Trait; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.datatypes.ColorType; | |||
import org.apache.fop.fo.FOTreeControl; | |||
import org.apache.fop.fo.properties.BackgroundRepeat; | |||
@@ -460,16 +460,16 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
* @see org.apache.fop.render.Renderer#renderText(Text) | |||
*/ | |||
public void renderWord(Word word) { | |||
System.out.println("In render word: " + word.getWord()); | |||
public void renderText(TextArea text) { | |||
System.out.println("In render text: " + text.getTextArea()); | |||
Graphics2D graphics = currentPageImage.createGraphics(); | |||
String fontName = (String) word.getTrait(Trait.FONT_NAME); | |||
int size = ((Integer) word.getTrait(Trait.FONT_SIZE)).intValue(); | |||
String fontName = (String) text.getTrait(Trait.FONT_NAME); | |||
int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue(); | |||
// Typeface f = (Typeface) fontInfo.getFonts().get(fontName); | |||
ColorType ct = (ColorType) word.getTrait(Trait.COLOR); | |||
ColorType ct = (ColorType) text.getTrait(Trait.COLOR); | |||
FontMetricsMapper mapper = (FontMetricsMapper) | |||
fontInfo.getMetricsFor(fontName); | |||
@@ -485,16 +485,16 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable | |||
10)); | |||
int rx = currentBlockIPPosition; | |||
int bl = currentBPPosition + word.getOffset(); | |||
int bl = currentBPPosition + text.getOffset(); | |||
int newx = (int) (rx + 500) / 1000; | |||
int newy = (int) (pageHeight - (bl + 500) / 1000); | |||
String s = word.getWord(); | |||
String s = text.getTextArea(); | |||
// graphics.drawString(s, newx, newy); | |||
graphics.drawString(s, 220, 200); | |||
// TODO: render text decorations | |||
currentBlockIPPosition += word.getWidth(); | |||
currentBlockIPPosition += text.getWidth(); | |||
} | |||
} |
@@ -83,7 +83,7 @@ import org.apache.fop.area.Trait; | |||
import org.apache.fop.area.TreeExt; | |||
import org.apache.fop.area.extensions.BookmarkData; | |||
import org.apache.fop.area.inline.Character; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.ForeignObject; | |||
import org.apache.fop.area.inline.Image; | |||
@@ -889,13 +889,13 @@ public class PDFRenderer extends PrintRenderer { | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
* @see org.apache.fop.render.Renderer#renderText(Text) | |||
*/ | |||
public void renderWord(Word word) { | |||
public void renderText(TextArea text) { | |||
StringBuffer pdf = new StringBuffer(); | |||
String name = (String) word.getTrait(Trait.FONT_NAME); | |||
int size = ((Integer) word.getTrait(Trait.FONT_SIZE)).intValue(); | |||
String name = (String) text.getTrait(Trait.FONT_NAME); | |||
int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue(); | |||
// This assumes that *all* CIDFonts use a /ToUnicode mapping | |||
Typeface f = (Typeface) fontInfo.getFonts().get(name); | |||
@@ -906,7 +906,7 @@ public class PDFRenderer extends PrintRenderer { | |||
String endText = useMultiByte ? "> " : ") "; | |||
updateFont(name, size, pdf); | |||
ColorType ct = (ColorType)word.getTrait(Trait.COLOR); | |||
ColorType ct = (ColorType) text.getTrait(Trait.COLOR); | |||
if (ct != null) { | |||
updateColor(ct, true, pdf); | |||
} | |||
@@ -915,12 +915,12 @@ public class PDFRenderer extends PrintRenderer { | |||
// currentBlockIPPosition: 0 for beginning of line; nonzero | |||
// where previous line area failed to take up entire allocated space | |||
int rx = currentBlockIPPosition + IPMarginOffset; | |||
int bl = currentBPPosition + BPMarginOffset + word.getOffset(); | |||
int bl = currentBPPosition + BPMarginOffset + text.getOffset(); | |||
/* System.out.println("BlockIP Position: " + currentBlockIPPosition + | |||
"; currentBPPosition: " + currentBPPosition + | |||
"; offset: " + word.getOffset() + | |||
"; Word = " + word.getWord()); */ | |||
"; offset: " + text.getOffset() + | |||
"; Text = " + text.getTextArea()); */ | |||
// Set letterSpacing | |||
//float ls = fs.getLetterSpacing() / this.currentFontSize; | |||
@@ -952,10 +952,10 @@ public class PDFRenderer extends PrintRenderer { | |||
pdf.append(startText); | |||
} | |||
} | |||
prevWordWidth = word.getWidth(); | |||
prevWordWidth = text.getWidth(); | |||
prevWordX = rx; | |||
String s = word.getWord(); | |||
String s = text.getTextArea(); | |||
FontMetrics metrics = fontInfo.getMetricsFor(name); | |||
Font fs = new Font(name, metrics, size); | |||
@@ -964,7 +964,7 @@ public class PDFRenderer extends PrintRenderer { | |||
currentStream.add(pdf.toString()); | |||
super.renderWord(word); | |||
super.renderText(text); | |||
} | |||
/** |
@@ -69,7 +69,7 @@ import org.apache.fop.area.CTM; | |||
import org.apache.fop.area.PageViewport; | |||
import org.apache.fop.area.Trait; | |||
import org.apache.fop.area.inline.ForeignObject; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.datatypes.ColorType; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fonts.Typeface; | |||
@@ -466,9 +466,9 @@ public class PSRenderer extends AbstractRenderer { | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
* @see org.apache.fop.render.Renderer#renderText(Text) | |||
*/ | |||
public void renderWord(Word area) { | |||
public void renderText(TextArea area) { | |||
String fontname = (String)area.getTrait(Trait.FONT_NAME); | |||
int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE); | |||
@@ -481,7 +481,7 @@ public class PSRenderer extends AbstractRenderer { | |||
useFont(fontname, fontsize); | |||
paintText(rx, bl, area.getWord(), f); | |||
paintText(rx, bl, area.getTextArea(), f); | |||
/* | |||
String psString = null; | |||
@@ -514,7 +514,7 @@ public class PSRenderer extends AbstractRenderer { | |||
write("OLE"); | |||
this.currentXPosition += area.getContentWidth(); | |||
*/ | |||
super.renderWord(area); //Updates IPD | |||
super.renderText(area); //Updates IPD | |||
} | |||
@@ -55,7 +55,7 @@ import org.apache.fop.area.PageViewport; | |||
import org.apache.fop.area.Title; | |||
import org.apache.fop.area.inline.ForeignObject; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.svg.SVGUtilities; | |||
import org.apache.fop.apps.Document; | |||
import org.apache.fop.apps.FOUserAgent; | |||
@@ -67,10 +67,9 @@ import org.w3c.dom.svg.SVGSVGElement; | |||
import org.w3c.dom.svg.SVGDocument; | |||
/* org.w3c.dom.Document is not imported to avoid conflict with | |||
org.apache.fop.control.Document */ | |||
import org.w3c.dom.Element; | |||
import org.w3c.dom.DOMImplementation; | |||
import org.w3c.dom.Element; | |||
import org.w3c.dom.Text; | |||
import org.apache.batik.dom.svg.SVGDOMImplementation; | |||
import org.apache.batik.dom.util.XMLSupport; | |||
import org.apache.batik.transcoder.svg2svg.SVGTranscoder; | |||
@@ -425,16 +424,16 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
* @see org.apache.fop.render.Renderer#renderText(Text) | |||
*/ | |||
public void renderWord(Word word) { | |||
Element text = SVGUtilities.createText(svgDocument, | |||
public void renderText(TextArea text) { | |||
Element textElement = SVGUtilities.createText(svgDocument, | |||
currentBlockIPPosition / 1000, | |||
(currentBPPosition + word.getOffset()) / 1000, | |||
word.getWord()); | |||
currentPageG.appendChild(text); | |||
(currentBPPosition + text.getOffset()) / 1000, | |||
text.getTextArea()); | |||
currentPageG.appendChild(textElement); | |||
super.renderWord(word); | |||
super.renderText(text); | |||
} | |||
/** |
@@ -91,7 +91,7 @@ import org.apache.fop.area.inline.InlineParent; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.fo.properties.RuleStyle; | |||
import org.apache.fop.fo.FOTreeControl; | |||
import org.apache.fop.fo.pagination.Region; | |||
@@ -453,17 +453,17 @@ public class XMLRenderer extends AbstractRenderer { | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
* @see org.apache.fop.render.Renderer#renderText(Text) | |||
*/ | |||
public void renderWord(Word word) { | |||
public void renderText(TextArea text) { | |||
String prop = ""; | |||
Map map = word.getTraits(); | |||
Map map = text.getTraits(); | |||
if (map != null) { | |||
prop = " props=\"" + getPropString(map) + "\""; | |||
} | |||
writeElement("<word wsadjust=\"" + word.getWSadjust() + "\"" | |||
+ prop + ">" + word.getWord() + "</word>"); | |||
super.renderWord(word); | |||
writeElement("<text tsadjust=\"" + text.getTSadjust() + "\"" | |||
+ prop + ">" + text.getTextArea() + "</text>"); | |||
super.renderText(text); | |||
} | |||
/** |
@@ -99,7 +99,7 @@ import org.apache.fop.area.inline.InlineArea; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.apps.Document; | |||
import org.apache.fop.fonts.Font; | |||
import org.apache.fop.render.Renderer; | |||
@@ -589,13 +589,13 @@ class TreeLoader extends AbstractLogEnabled { | |||
FontMetrics metrics = fontInfo.getMetricsFor(fname); | |||
currentFontState = | |||
new Font(fname, metrics, 12000); | |||
Word word = getWord((Element) obj); | |||
TextArea text = getText((Element) obj); | |||
word.addTrait(Trait.FONT_NAME, fname); | |||
word.addTrait(Trait.FONT_SIZE, new Integer(12000)); | |||
text.addTrait(Trait.FONT_NAME, fname); | |||
text.addTrait(Trait.FONT_SIZE, new Integer(12000)); | |||
if (word != null) { | |||
list.add(word); | |||
if (text != null) { | |||
list.add(text); | |||
} | |||
} else { | |||
} | |||
@@ -723,19 +723,19 @@ class TreeLoader extends AbstractLogEnabled { | |||
return leader; | |||
} | |||
Word getWord(Element root) { | |||
TextArea getText(Element root) { | |||
String str = getString(root); | |||
Word word = new Word(); | |||
word.setWord(str); | |||
addTraits(root, word); | |||
TextArea text = new TextArea(); | |||
text.setTextArea(str); | |||
addTraits(root, text); | |||
int width = 0; | |||
for (int count = 0; count < str.length(); count++) { | |||
width += currentFontState.getWidth(str.charAt(count)); | |||
} | |||
word.setWidth(width); | |||
word.setOffset(currentFontState.getCapHeight()); | |||
text.setWidth(width); | |||
text.setOffset(currentFontState.getCapHeight()); | |||
return word; | |||
return text; | |||
} | |||