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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. //TODO this class is redundant: BFEntry does the same but doesn't have an intuitive name
  25. private int unicodeStart;
  26. private int unicodeEnd;
  27. private int glyphStartIndex;
  28. TTFCmapEntry() {
  29. unicodeStart = 0;
  30. unicodeEnd = 0;
  31. glyphStartIndex = 0;
  32. }
  33. TTFCmapEntry(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 = super.hashCode();
  44. hc ^= ( hc * 11 ) + unicodeStart;
  45. hc ^= ( hc * 19 ) + unicodeEnd;
  46. hc ^= ( hc * 23 ) + glyphStartIndex;
  47. return hc;
  48. }
  49. /**
  50. * {@inheritDoc}
  51. */
  52. @Override
  53. public boolean equals(Object o) {
  54. if (o instanceof TTFCmapEntry) {
  55. TTFCmapEntry ce = (TTFCmapEntry)o;
  56. if (ce.unicodeStart == this.unicodeStart
  57. && ce.unicodeEnd == this.unicodeEnd
  58. && ce.glyphStartIndex == this.glyphStartIndex) {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. /**
  65. * Returns the glyphStartIndex.
  66. * @return int
  67. */
  68. public int getGlyphStartIndex() {
  69. return glyphStartIndex;
  70. }
  71. /**
  72. * Returns the unicodeEnd.
  73. * @return int
  74. */
  75. public int getUnicodeEnd() {
  76. return unicodeEnd;
  77. }
  78. /**
  79. * Returns the unicodeStart.
  80. * @return int
  81. */
  82. public int getUnicodeStart() {
  83. return unicodeStart;
  84. }
  85. /**
  86. * Sets the glyphStartIndex.
  87. * @param glyphStartIndex The glyphStartIndex to set
  88. */
  89. public void setGlyphStartIndex(int glyphStartIndex) {
  90. this.glyphStartIndex = glyphStartIndex;
  91. }
  92. /**
  93. * Sets the unicodeEnd.
  94. * @param unicodeEnd The unicodeEnd to set
  95. */
  96. public void setUnicodeEnd(int unicodeEnd) {
  97. this.unicodeEnd = unicodeEnd;
  98. }
  99. /**
  100. * Sets the unicodeStart.
  101. * @param unicodeStart The unicodeStart to set
  102. */
  103. public void setUnicodeStart(int unicodeStart) {
  104. this.unicodeStart = unicodeStart;
  105. }
  106. }