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.

FontMetrics.java 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.fonts;
  19. import java.util.Map;
  20. import java.util.Set;
  21. /**
  22. * Main interface for access to font metrics.
  23. */
  24. public interface FontMetrics {
  25. /**
  26. * Returns the "PostScript" font name (Example: "Helvetica-BoldOblique").
  27. * @return the font name
  28. */
  29. String getFontName();
  30. /**
  31. * Returns the font's full name (Example: "Helvetica Bold Oblique").
  32. * @return the font's full name
  33. */
  34. String getFullName();
  35. /**
  36. * Returns the font's family names as a Set of Strings (Example: "Helvetica").
  37. * @return the font's family names (a Set of Strings)
  38. */
  39. Set getFamilyNames();
  40. /**
  41. * Returns the font name for font embedding (may include a prefix, Example: "1E28bcArialMT").
  42. * @return the name for font embedding
  43. */
  44. String getEmbedFontName();
  45. /**
  46. * Returns the type of the font.
  47. * @return the font type
  48. */
  49. FontType getFontType();
  50. /**
  51. * Returns the maximum ascent of the font described by this
  52. * FontMetrics object. Note: This is not the same as getAscender().
  53. * @param size font size
  54. * @return ascent in milliponts
  55. */
  56. int getMaxAscent(int size);
  57. /**
  58. * Returns the ascent of the font described by this
  59. * FontMetrics object. It returns the nominal ascent within the em box.
  60. * @param size font size
  61. * @return ascent in milliponts
  62. */
  63. int getAscender(int size);
  64. /**
  65. * Returns the size of a capital letter measured from the font's baseline.
  66. * @param size font size
  67. * @return height of capital characters
  68. */
  69. int getCapHeight(int size);
  70. /**
  71. * Returns the descent of the font described by this
  72. * FontMetrics object.
  73. * @param size font size
  74. * @return descent in milliponts
  75. */
  76. int getDescender(int size);
  77. /**
  78. * Determines the typical font height of this
  79. * FontMetrics object
  80. * @param size font size
  81. * @return font height in millipoints
  82. */
  83. int getXHeight(int size);
  84. /**
  85. * Return the width (in 1/1000ths of point size) of the character at
  86. * code point i.
  87. * @param i code point index
  88. * @param size font size
  89. * @return the width of the character
  90. */
  91. int getWidth(int i, int size);
  92. /**
  93. * Return the array of widths.
  94. * <p>
  95. * This is used to get an array for inserting in an output format.
  96. * It should not be used for lookup.
  97. * @return an array of widths
  98. */
  99. int[] getWidths();
  100. /**
  101. * Indicates if the font has kering information.
  102. * @return True, if kerning is available.
  103. */
  104. boolean hasKerningInfo();
  105. /**
  106. * Returns the kerning map for the font.
  107. * @return the kerning map
  108. */
  109. Map getKerningInfo();
  110. }