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.

AFPFontAttributes.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.afp.fonts;
  19. /**
  20. * This class encapsulates the font attributes that need to be included
  21. * in the AFP data stream. This class does not assist in converting the
  22. * font attributes to AFP code pages and character set values.
  23. */
  24. public class AFPFontAttributes {
  25. /** the font reference */
  26. private int fontReference;
  27. /** the font key */
  28. private final String fontKey;
  29. /** the font */
  30. private final AFPFont font;
  31. /** the point size */
  32. private final int pointSize;
  33. /**
  34. * Constructor for the AFPFontAttributes
  35. *
  36. * @param fontKey the font key
  37. * @param font the font
  38. * @param pointSize the point size
  39. */
  40. public AFPFontAttributes(String fontKey, AFPFont font, int pointSize) {
  41. this.fontKey = fontKey;
  42. this.font = font;
  43. this.pointSize = pointSize;
  44. }
  45. /**
  46. * Return the font
  47. *
  48. * @return the font
  49. */
  50. public AFPFont getFont() {
  51. return font;
  52. }
  53. /**
  54. * Return the FontKey attribute
  55. *
  56. * @return the FontKey attribute
  57. */
  58. public String getFontKey() {
  59. return fontKey + pointSize;
  60. }
  61. /**
  62. * Return the point size attribute
  63. *
  64. * @return the point size attribute
  65. */
  66. public int getPointSize() {
  67. return pointSize;
  68. }
  69. /**
  70. * Return the FontReference attribute
  71. *
  72. * @return the FontReference attribute
  73. */
  74. public int getFontReference() {
  75. return fontReference;
  76. }
  77. /**
  78. * Sets the FontReference attribute
  79. *
  80. * @param fontReference the FontReference to set
  81. */
  82. public void setFontReference(int fontReference) {
  83. this.fontReference = fontReference;
  84. }
  85. /** {@inheritDoc} */
  86. public String toString() {
  87. return "fontReference=" + fontReference
  88. + ", fontKey=" + fontKey
  89. + ", font=" + font
  90. + ", pointSize=" + pointSize;
  91. }
  92. }