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.

BFEntry.java 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. /**
  20. * This is just a holder class for bfentries, groups of characters of a base font (bf).
  21. */
  22. public final class BFEntry {
  23. //TODO Think about renaming this class to CMapRange or something.
  24. private final int unicodeStart;
  25. private final int unicodeEnd;
  26. private final int glyphStartIndex;
  27. /**
  28. * Main constructor.
  29. * @param unicodeStart Unicode start index
  30. * @param unicodeEnd Unicode end index
  31. * @param glyphStartIndex glyph start index
  32. */
  33. public BFEntry(int unicodeStart, int unicodeEnd, int glyphStartIndex) {
  34. this.unicodeStart = unicodeStart;
  35. this.unicodeEnd = unicodeEnd;
  36. this.glyphStartIndex = glyphStartIndex;
  37. }
  38. /**
  39. * {@inheritDoc}
  40. */
  41. @Override
  42. public int hashCode() {
  43. int hc = 17;
  44. hc = 31 * hc + unicodeStart;
  45. hc = 31 * hc + unicodeEnd;
  46. hc = 31 * hc + glyphStartIndex;
  47. return hc;
  48. }
  49. /**
  50. * {@inheritDoc}
  51. */
  52. @Override
  53. public boolean equals(Object o) {
  54. if (o instanceof BFEntry) {
  55. BFEntry ce = (BFEntry) o;
  56. return ce.unicodeStart == this.unicodeStart
  57. && ce.unicodeEnd == this.unicodeEnd
  58. && ce.glyphStartIndex == this.glyphStartIndex;
  59. }
  60. return false;
  61. }
  62. /**
  63. * Returns the unicodeStart.
  64. * @return the Unicode start index
  65. */
  66. public int getUnicodeStart() {
  67. return unicodeStart;
  68. }
  69. /**
  70. * Returns the unicodeEnd.
  71. * @return the Unicode end index
  72. */
  73. public int getUnicodeEnd() {
  74. return unicodeEnd;
  75. }
  76. /**
  77. * Returns the glyphStartIndex.
  78. * @return the glyph start index
  79. */
  80. public int getGlyphStartIndex() {
  81. return glyphStartIndex;
  82. }
  83. }