Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

AFPFontAttributes.java 2.4KB

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