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

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