Browse Source

Fixups + necessary changes after r1067689

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1067693 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_1rc1old
Andreas L. Delmelle 13 years ago
parent
commit
8f57470e9e
1 changed files with 16 additions and 10 deletions
  1. 16
    10
      src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java

+ 16
- 10
src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java View File

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public void initialize() { public void initialize() {
Character fobj = (Character)this.fobj; Character fobj = (Character)this.fobj;
font = FontSelector.selectFontForCharacter(fobj, this); font = FontSelector.selectFontForCharacter(fobj, this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment) { public List getNextKnuthElements(LayoutContext context, int alignment) {
MinOptMax ipd; MinOptMax ipd;
curArea = get(context); curArea = get(context);


addKnuthElementsForBorderPaddingEnd(seq); addKnuthElementsForBorderPaddingEnd(seq);


LinkedList returnList = new LinkedList();
LinkedList<KnuthSequence> returnList = new LinkedList<KnuthSequence>();
returnList.add(seq); returnList.add(seq);
setFinished(true); setFinished(true);
return returnList; return returnList;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public String getWordChars(Position pos) { public String getWordChars(Position pos) {
return ((TextArea) curArea).getText(); return ((TextArea) curArea).getText();
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public void hyphenate(Position pos, HyphContext hc) { public void hyphenate(Position pos, HyphContext hc) {
if (hc.getNextHyphPoint() == 1) { if (hc.getNextHyphPoint() == 1) {
// the character ends a syllable // the character ends a syllable
areaInfo.bHyphenated = true;
isSomethingChanged = true;
areaInfo.isHyphenated = true;
somethingChanged = true;
} else { } else {
// hc.getNextHyphPoint() returned -1 (no more hyphenation points) // hc.getNextHyphPoint() returned -1 (no more hyphenation points)
// or a number > 1; // or a number > 1;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public boolean applyChanges(List oldList) { public boolean applyChanges(List oldList) {
setFinished(false); setFinished(false);
return isSomethingChanged;
return somethingChanged;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment) { public List getChangedKnuthElements(List oldList, int alignment) {
if (isFinished()) { if (isFinished()) {
return null; return null;
} }


LinkedList returnList = new LinkedList();
LinkedList<KnuthElement> returnList = new LinkedList<KnuthElement>();


addKnuthElementsForBorderPaddingStart(returnList); addKnuthElementsForBorderPaddingStart(returnList);


if (letterSpaceIPD.isStiff() || areaInfo.iLScount == 0) {
if (letterSpaceIPD.isStiff() || areaInfo.letterSpaces == 0) {
// constant letter space, or no letter space // constant letter space, or no letter space
returnList.add(new KnuthInlineBox(areaInfo.ipdArea.getOpt(), returnList.add(new KnuthInlineBox(areaInfo.ipdArea.getOpt(),
areaInfo.alignmentContext, areaInfo.alignmentContext,
notifyPos(new LeafPosition(this, 0)), false)); notifyPos(new LeafPosition(this, 0)), false));
if (areaInfo.bHyphenated) {
if (areaInfo.isHyphenated) {
returnList.add(new KnuthPenalty(hyphIPD, KnuthPenalty.FLAGGED_PENALTY, true, returnList.add(new KnuthPenalty(hyphIPD, KnuthPenalty.FLAGGED_PENALTY, true,
new LeafPosition(this, -1), false)); new LeafPosition(this, -1), false));
} }
} else { } else {
// adjustable letter space // adjustable letter space
returnList.add(new KnuthInlineBox(areaInfo.ipdArea.getOpt() returnList.add(new KnuthInlineBox(areaInfo.ipdArea.getOpt()
- areaInfo.iLScount * letterSpaceIPD.getOpt(), areaInfo.alignmentContext,
- areaInfo.letterSpaces * letterSpaceIPD.getOpt(), areaInfo.alignmentContext,
notifyPos(new LeafPosition(this, 0)), false)); notifyPos(new LeafPosition(this, 0)), false));
returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true)); new LeafPosition(this, -1), true));
returnList.add(new KnuthGlue(letterSpaceIPD.mult(areaInfo.iLScount),
returnList.add(new KnuthGlue(letterSpaceIPD.mult(areaInfo.letterSpaces),
new LeafPosition(this, -1), true)); new LeafPosition(this, -1), true));
returnList.add ( returnList.add (
new KnuthInlineBox(0, null, notifyPos(new LeafPosition(this, -1)), true)); new KnuthInlineBox(0, null, notifyPos(new LeafPosition(this, -1)), true));
if (areaInfo.bHyphenated) {
if (areaInfo.isHyphenated) {
returnList.add(new KnuthPenalty(hyphIPD, KnuthPenalty.FLAGGED_PENALTY, true, returnList.add(new KnuthPenalty(hyphIPD, KnuthPenalty.FLAGGED_PENALTY, true,
new LeafPosition(this, -1), false)); new LeafPosition(this, -1), false));
} }

Loading…
Cancel
Save