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.

AFPFont.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. import java.util.Map;
  20. import java.util.Set;
  21. import org.apache.fop.fonts.FontType;
  22. import org.apache.fop.fonts.Typeface;
  23. /**
  24. * All implementations of AFP fonts should extend this base class,
  25. * the object implements the FontMetrics information.
  26. * <p/>
  27. */
  28. public abstract class AFPFont extends Typeface {
  29. /** The font name */
  30. protected String name;
  31. /**
  32. * Constructor for the base font requires the name.
  33. * @param name the name of the font
  34. */
  35. public AFPFont(String name) {
  36. this.name = name;
  37. }
  38. /** {@inheritDoc} */
  39. public String getFontName() {
  40. return this.name;
  41. }
  42. /** {@inheritDoc} */
  43. public String getEmbedFontName() {
  44. return this.name;
  45. }
  46. /** {@inheritDoc} */
  47. public String getFullName() {
  48. return getFontName();
  49. }
  50. /** {@inheritDoc} */
  51. public Set getFamilyNames() {
  52. Set s = new java.util.HashSet();
  53. s.add(this.name);
  54. return s;
  55. }
  56. /**
  57. * Returns the type of the font.
  58. * @return the font type
  59. */
  60. public FontType getFontType() {
  61. return FontType.OTHER;
  62. }
  63. /**
  64. * Indicates if the font has kerning information.
  65. * @return True, if kerning is available.
  66. */
  67. public boolean hasKerningInfo() {
  68. return false;
  69. }
  70. /**
  71. * Returns the kerning map for the font.
  72. * @return the kerning map
  73. */
  74. public Map getKerningInfo() {
  75. return null;
  76. }
  77. /**
  78. * Returns the character set for a given size
  79. * @param size the font size
  80. * @return the character set object
  81. */
  82. public abstract CharacterSet getCharacterSet(int size);
  83. /**
  84. * Indicates if this font may be embedded.
  85. * @return True, if embedding is possible/permitted
  86. */
  87. public boolean isEmbeddable() {
  88. return false; //TODO Complete AFP font embedding
  89. }
  90. /** {@inheritDoc} */
  91. public String toString() {
  92. return "name=" + name;
  93. }
  94. }