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.

CIDSet.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.BitSet;
  20. import java.util.Map;
  21. /**
  22. * Declares methods to retrieve font information (glyph indices, widths, unicode values) from a CID font.
  23. */
  24. public interface CIDSet {
  25. /**
  26. * Returns the original index of the glyph inside the (non-subset) font's glyph list. This
  27. * index can be used to access the character width information, for example.
  28. * @param index the subset index (character selector) to access the glyph
  29. * @return the original index (or -1 if no glyph index is available for the subset index)
  30. */
  31. int getOriginalGlyphIndex(int index);
  32. /**
  33. * Returns the Unicode value for a subset index (character selector). If there's no such
  34. * Unicode value, the "NOT A CHARACTER" (0xFFFF) is returned.
  35. * @param subsetIndex the subset index (character selector)
  36. * @return the Unicode value or "NOT A CHARACTER" (0xFFFF)
  37. */
  38. char getUnicode(int index);
  39. /**
  40. * Maps a character to a character selector for a font subset. If the character isn't in the
  41. * subset, yet, it is added and a new character selector returned. Otherwise, the already
  42. * allocated character selector is returned from the existing map/subset.
  43. * @param glyphIndex the glyph index of the character
  44. * @param unicode the Unicode index of the character
  45. * @return the subset index
  46. */
  47. int mapChar(int glyphIndex, char unicode);
  48. /**
  49. * Returns an unmodifiable Map of the font subset. It maps from glyph index to
  50. * character selector (i.e. the subset index in this case).
  51. * @return Map Map<Integer, Integer> of the font subset
  52. */
  53. Map<Integer, Integer> getGlyphs();
  54. /**
  55. * Returns a char array containing all Unicode characters that are in the subset.
  56. * @return a char array with all used Unicode characters
  57. */
  58. char[] getChars();
  59. /**
  60. * Returns the number of glyphs in the subset.
  61. * @return the number of glyphs in the subset
  62. */
  63. int getNumberOfGlyphs();
  64. /**
  65. * Returns a BitSet with bits set for each available glyph index in the subset.
  66. * @return a BitSet indicating available glyph indices
  67. */
  68. BitSet getGlyphIndices();
  69. /**
  70. * Return the array of widths.
  71. * <p>
  72. * This is used to get an array for inserting in an output format.
  73. * It should not be used for lookup.
  74. * @return an array of widths
  75. */
  76. int[] getWidths();
  77. }