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.

CIDFont.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 org.apache.fop.apps.io.InternalResourceResolver;
  20. //Java
  21. /**
  22. * Abstract base class for CID fonts.
  23. */
  24. public abstract class CIDFont extends CustomFont {
  25. /** Contains the character widths for all characters in the font */
  26. protected int[] width;
  27. /**
  28. * @param resourceResolver the URI resolver for controlling file access
  29. */
  30. public CIDFont(InternalResourceResolver resourceResolver) {
  31. super(resourceResolver);
  32. }
  33. // ---- Required ----
  34. /**
  35. * Returns the type of the CID font.
  36. * @return the type of the CID font
  37. */
  38. public abstract CIDFontType getCIDType();
  39. /**
  40. * Returns the name of the issuer of the font.
  41. * @return a String identifying an issuer of character collections -
  42. * for example, Adobe
  43. */
  44. public abstract String getRegistry();
  45. /**
  46. * Returns a font name for use within a registry.
  47. * @return a String that uniquely names a character collection issued by
  48. * a specific registry - for example, Japan1.
  49. */
  50. public abstract String getOrdering();
  51. /**
  52. * Returns the supplement number of the character collection.
  53. * @return the supplement number
  54. */
  55. public abstract int getSupplement();
  56. /**
  57. * Returns the subset information for this font.
  58. * @return the subset information
  59. */
  60. public abstract CIDSet getCIDSet();
  61. /**
  62. * Determines whether this font contains a particular code point/glyph.
  63. * @param cp character to check
  64. * @return True if the character is supported, False otherwise
  65. */
  66. public abstract boolean hasCodePoint(int cp);
  67. /**
  68. * Map a Unicode code point to a code point in the font.
  69. * @param cp code point to map
  70. * @return the mapped code point
  71. */
  72. public abstract int mapCodePoint(int cp);
  73. // ---- Optional ----
  74. /**
  75. * Returns the default width for this font.
  76. * @return the default width
  77. */
  78. public int getDefaultWidth() {
  79. return 0;
  80. }
  81. /** {@inheritDoc} */
  82. public boolean isMultiByte() {
  83. return getFontType() != FontType.TYPE1C;
  84. }
  85. }