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.

KnuthBox.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.layoutmgr;
  18. /**
  19. * An instance of this class represents an unbreakable piece of content with
  20. * fixed width: for example an image, a syllable (but only if letter spacing
  21. * is constant), ...
  22. *
  23. * A KnuthBox is never a feasible breaking point.
  24. *
  25. * The represented piece of content is never suppressed.
  26. *
  27. * Besides the inherited methods and attributes, this class has some more
  28. * attributes to store information about the content height and its vertical
  29. * positioning, and the methods used to get them.
  30. */
  31. public class KnuthBox extends KnuthElement {
  32. private int lead;
  33. private int total;
  34. private int middle;
  35. /**
  36. * Create a new KnuthBox.
  37. *
  38. * @param w the width of this box
  39. * @param l the height of this box above the main baseline
  40. * @param t the total height of this box
  41. * @param m the height of this box above and below the middle baseline
  42. * @param pos the Position stored in this box
  43. * @param bAux is this box auxiliary?
  44. */
  45. public KnuthBox(int w, int l, int t, int m, Position pos, boolean bAux) {
  46. super(KNUTH_BOX, w, pos, bAux);
  47. lead = l;
  48. total = t;
  49. middle = m;
  50. }
  51. /**
  52. * Return the height of this box above the main baseline.
  53. */
  54. public int getLead() {
  55. return lead;
  56. }
  57. /**
  58. * Return the total height of this box.
  59. */
  60. public int getTotal() {
  61. return total;
  62. }
  63. /**
  64. * Return the height of this box above and below the middle baseline.
  65. */
  66. public int getMiddle() {
  67. return middle;
  68. }
  69. }