You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Character.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.fo.flow;
  8. // fop
  9. import org.apache.fop.fo.*;
  10. import org.apache.fop.fo.properties.*;
  11. import org.apache.fop.datatypes.ColorType;
  12. import org.apache.fop.fo.FObj;
  13. import org.apache.fop.layout.FontState;
  14. import org.apache.fop.layout.AuralProps;
  15. import org.apache.fop.layout.BorderAndPadding;
  16. import org.apache.fop.layout.BackgroundProps;
  17. import org.apache.fop.layout.HyphenationProps;
  18. import org.apache.fop.layout.MarginInlineProps;
  19. import org.apache.fop.layout.RelativePositionProps;
  20. import org.apache.fop.apps.FOPException;
  21. import org.apache.fop.area.inline.InlineArea;
  22. import org.apache.fop.layoutmgr.LayoutManager;
  23. import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
  24. /**
  25. * this class represents the flow object 'fo:character'. Its use is defined by
  26. * the spec: "The fo:character flow object represents a character that is mapped to
  27. * a glyph for presentation. It is an atomic unit to the formatter.
  28. * When the result tree is interpreted as a tree of formatting objects,
  29. * a character in the result tree is treated as if it were an empty
  30. * element of type fo:character with a character attribute
  31. * equal to the Unicode representation of the character.
  32. * The semantics of an "auto" value for character properties, which is
  33. * typically their initial value, are based on the Unicode codepoint.
  34. * Overrides may be specified in an implementation-specific manner." (6.6.3)
  35. *
  36. */
  37. public class Character extends FObj {
  38. public final static int OK = 0;
  39. public final static int DOESNOT_FIT = 1;
  40. private char characterValue;
  41. public Character(FONode parent) {
  42. super(parent);
  43. }
  44. public LayoutManager getLayoutManager() {
  45. LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
  46. lm.setCurrentArea(getInlineArea());
  47. return lm;
  48. }
  49. protected InlineArea getInlineArea() {
  50. return null;
  51. }
  52. public void setup() throws FOPException {
  53. // Common Aural Properties
  54. AuralProps mAurProps = propMgr.getAuralProps();
  55. // Common Border, Padding, and Background Properties
  56. BorderAndPadding bap = propMgr.getBorderAndPadding();
  57. BackgroundProps bProps = propMgr.getBackgroundProps();
  58. // Common Font Properties
  59. //this.fontState = propMgr.getFontState(area.getFontInfo());
  60. // Common Hyphenation Properties
  61. HyphenationProps mHyphProps = propMgr.getHyphenationProps();
  62. // Common Margin Properties-Inline
  63. MarginInlineProps mProps = propMgr.getMarginInlineProps();
  64. // Common Relative Position Properties
  65. RelativePositionProps mRelProps = propMgr.getRelativePositionProps();
  66. // this.properties.get("alignment-adjust");
  67. // this.properties.get("treat-as-word-space");
  68. // this.properties.get("alignment-baseline");
  69. // this.properties.get("baseline-shift");
  70. // this.properties.get("character");
  71. // this.properties.get("color");
  72. // this.properties.get("dominant-baseline");
  73. // this.properties.get("text-depth");
  74. // this.properties.get("text-altitude");
  75. // this.properties.get("glyph-orientation-horizontal");
  76. // this.properties.get("glyph-orientation-vertical");
  77. // this.properties.get("id");
  78. // this.properties.get("keep-with-next");
  79. // this.properties.get("keep-with-previous");
  80. // this.properties.get("letter-spacing");
  81. // this.properties.get("line-height");
  82. // this.properties.get("line-height-shift-adjustment");
  83. // this.properties.get("score-spaces");
  84. // this.properties.get("suppress-at-line-break");
  85. // this.properties.get("text-decoration");
  86. // this.properties.get("text-shadow");
  87. // this.properties.get("text-transform");
  88. // this.properties.get("word-spacing");
  89. }
  90. public CharIterator charIterator() {
  91. return new OneCharIterator(characterValue);
  92. // But what it the character is ignored due to white space handling?
  93. }
  94. }