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.

TTFCmapEntry.java 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.truetype;
  19. /**
  20. * The CMap entry contains information of a Unicode range and the
  21. * the glyph indexes related to the range
  22. */
  23. public class TTFCmapEntry {
  24. private int unicodeStart;
  25. private int unicodeEnd;
  26. private int glyphStartIndex;
  27. TTFCmapEntry() {
  28. unicodeStart = 0;
  29. unicodeEnd = 0;
  30. glyphStartIndex = 0;
  31. }
  32. TTFCmapEntry(int unicodeStart, int unicodeEnd, int glyphStartIndex) {
  33. this.unicodeStart = unicodeStart;
  34. this.unicodeEnd = unicodeEnd;
  35. this.glyphStartIndex = glyphStartIndex;
  36. }
  37. /**
  38. * {@inheritDoc}
  39. */
  40. public int hashCode() {
  41. int hc = super.hashCode();
  42. hc ^= ( hc * 11 ) + unicodeStart;
  43. hc ^= ( hc * 19 ) + unicodeEnd;
  44. hc ^= ( hc * 23 ) + glyphStartIndex;
  45. return hc;
  46. }
  47. /**
  48. * {@inheritDoc}
  49. */
  50. public boolean equals(Object o) {
  51. if (o instanceof TTFCmapEntry) {
  52. TTFCmapEntry ce = (TTFCmapEntry)o;
  53. if (ce.unicodeStart == this.unicodeStart
  54. && ce.unicodeEnd == this.unicodeEnd
  55. && ce.glyphStartIndex == this.glyphStartIndex) {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. /**
  62. * Returns the glyphStartIndex.
  63. * @return int
  64. */
  65. public int getGlyphStartIndex() {
  66. return glyphStartIndex;
  67. }
  68. /**
  69. * Returns the unicodeEnd.
  70. * @return int
  71. */
  72. public int getUnicodeEnd() {
  73. return unicodeEnd;
  74. }
  75. /**
  76. * Returns the unicodeStart.
  77. * @return int
  78. */
  79. public int getUnicodeStart() {
  80. return unicodeStart;
  81. }
  82. /**
  83. * Sets the glyphStartIndex.
  84. * @param glyphStartIndex The glyphStartIndex to set
  85. */
  86. public void setGlyphStartIndex(int glyphStartIndex) {
  87. this.glyphStartIndex = glyphStartIndex;
  88. }
  89. /**
  90. * Sets the unicodeEnd.
  91. * @param unicodeEnd The unicodeEnd to set
  92. */
  93. public void setUnicodeEnd(int unicodeEnd) {
  94. this.unicodeEnd = unicodeEnd;
  95. }
  96. /**
  97. * Sets the unicodeStart.
  98. * @param unicodeStart The unicodeStart to set
  99. */
  100. public void setUnicodeStart(int unicodeStart) {
  101. this.unicodeStart = unicodeStart;
  102. }
  103. }