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