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.

OFMtxEntry.java 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. import java.util.List;
  20. /**
  21. * This class represents a TrueType Mtx Entry.
  22. */
  23. public class OFMtxEntry {
  24. private int wx;
  25. private int lsb;
  26. private String name = "";
  27. private int index;
  28. private List unicodeIndex = new java.util.ArrayList();
  29. private int[] boundingBox = new int[4];
  30. private long offset;
  31. private byte found = 0;
  32. /**
  33. * Returns a String representation of this object.
  34. *
  35. * @param t TTFFile to use for unit conversion
  36. * @return String String representation
  37. */
  38. public String toString(TTFFile t) {
  39. return "Glyph " + name + " index: " + getIndexAsString() + " bbox ["
  40. + t.convertTTFUnit2PDFUnit(boundingBox[0]) + " "
  41. + t.convertTTFUnit2PDFUnit(boundingBox[1]) + " "
  42. + t.convertTTFUnit2PDFUnit(boundingBox[2]) + " "
  43. + t.convertTTFUnit2PDFUnit(boundingBox[3]) + "] wx: "
  44. + t.convertTTFUnit2PDFUnit(wx);
  45. }
  46. /**
  47. * Returns the boundingBox.
  48. * @return int[]
  49. */
  50. public int[] getBoundingBox() {
  51. return boundingBox;
  52. }
  53. /**
  54. * Sets the boundingBox.
  55. * @param boundingBox The boundingBox to set
  56. */
  57. public void setBoundingBox(int[] boundingBox) {
  58. this.boundingBox = boundingBox;
  59. }
  60. /**
  61. * Returns the found.
  62. * @return byte
  63. */
  64. public byte getFound() {
  65. return found;
  66. }
  67. /**
  68. * Returns the index.
  69. * @return int
  70. */
  71. public int getIndex() {
  72. return index;
  73. }
  74. /**
  75. * Determines whether this index represents a reserved character.
  76. * @return True if it is reserved
  77. */
  78. public boolean isIndexReserved() {
  79. return (getIndex() >= 32768) && (getIndex() <= 65535);
  80. }
  81. /**
  82. * Returns a String representation of the index taking into account if
  83. * the index is in the reserved range.
  84. * @return index as String
  85. */
  86. public String getIndexAsString() {
  87. if (isIndexReserved()) {
  88. return Integer.toString(getIndex()) + " (reserved)";
  89. } else {
  90. return Integer.toString(getIndex());
  91. }
  92. }
  93. /**
  94. * Returns the lsb.
  95. * @return int
  96. */
  97. public int getLsb() {
  98. return lsb;
  99. }
  100. /**
  101. * Returns the name.
  102. * @return String
  103. */
  104. public String getName() {
  105. return name;
  106. }
  107. /**
  108. * Returns the offset.
  109. * @return long
  110. */
  111. public long getOffset() {
  112. return offset;
  113. }
  114. /**
  115. * Returns the unicodeIndex.
  116. * @return List
  117. */
  118. public List getUnicodeIndex() {
  119. return unicodeIndex;
  120. }
  121. /**
  122. * Returns the wx.
  123. * @return int
  124. */
  125. public int getWx() {
  126. return wx;
  127. }
  128. /**
  129. * Sets the found.
  130. * @param found The found to set
  131. */
  132. public void setFound(byte found) {
  133. this.found = found;
  134. }
  135. /**
  136. * Sets the index.
  137. * @param index The index to set
  138. */
  139. public void setIndex(int index) {
  140. this.index = index;
  141. }
  142. /**
  143. * Sets the lsb.
  144. * @param lsb The lsb to set
  145. */
  146. public void setLsb(int lsb) {
  147. this.lsb = lsb;
  148. }
  149. /**
  150. * Sets the name.
  151. * @param name The name to set
  152. */
  153. public void setName(String name) {
  154. this.name = name;
  155. }
  156. /**
  157. * Sets the offset.
  158. * @param offset The offset to set
  159. */
  160. public void setOffset(long offset) {
  161. this.offset = offset;
  162. }
  163. /**
  164. * Sets the wx.
  165. * @param wx The wx to set
  166. */
  167. public void setWx(int wx) {
  168. this.wx = wx;
  169. }
  170. }