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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.layoutmgr;
  19. /**
  20. * An instance of this class represents an unbreakable piece of content with
  21. * fixed width: for example an image, a syllable (but only if letter spacing
  22. * is constant), ...
  23. *
  24. * A KnuthBox is never a feasible breaking point.
  25. *
  26. * The represented piece of content is never suppressed.
  27. *
  28. * Besides the inherited methods and attributes, this class has some more
  29. * attributes to store information about the content height and its vertical
  30. * positioning, and the methods used to get them.
  31. */
  32. public class KnuthBox extends KnuthElement {
  33. /**
  34. * Creates a new <code>KnuthBox</code>.
  35. *
  36. * @param width the width of this box
  37. * @param pos the Position stored in this box
  38. * @param auxiliary is this box auxiliary?
  39. */
  40. public KnuthBox(int width, Position pos, boolean auxiliary) {
  41. super(width, pos, auxiliary);
  42. }
  43. /** {@inheritDoc} */
  44. public boolean isBox() {
  45. return true;
  46. }
  47. /** {@inheritDoc} */
  48. public String toString() {
  49. StringBuffer buffer = new StringBuffer(64);
  50. if (isAuxiliary()) {
  51. buffer.append("aux. ");
  52. }
  53. buffer.append("box");
  54. buffer.append(" w=");
  55. buffer.append(getWidth());
  56. return buffer.toString();
  57. }
  58. }