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.

OFTableName.java 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. * Represents table names as found in a TrueType font's Table Directory.
  21. * TrueType fonts may have custom tables so we cannot use an enum.
  22. */
  23. public final class OFTableName {
  24. /** The first table in a TrueType font file containing metadata about other tables. */
  25. public static final OFTableName TABLE_DIRECTORY = new OFTableName("tableDirectory");
  26. /** Baseline data */
  27. public static final OFTableName BASE = new OFTableName("BASE");
  28. /** CFF data/ */
  29. public static final OFTableName CFF = new OFTableName("CFF ");
  30. /** Embedded bitmap data. */
  31. public static final OFTableName EBDT = new OFTableName("EBDT");
  32. /** Embedded bitmap location data. */
  33. public static final OFTableName EBLC = new OFTableName("EBLC");
  34. /** Embedded bitmap scaling data. */
  35. public static final OFTableName EBSC = new OFTableName("EBSC");
  36. /** A FontForge specific table. */
  37. public static final OFTableName FFTM = new OFTableName("FFTM");
  38. /** Divides glyphs into various classes that make using the GPOS/GSUB tables easier. */
  39. public static final OFTableName GDEF = new OFTableName("GDEF");
  40. /** Provides kerning information, mark-to-base, etc. for opentype fonts. */
  41. public static final OFTableName GPOS = new OFTableName("GPOS");
  42. /** Provides ligature information, swash, etc. for opentype fonts. */
  43. public static final OFTableName GSUB = new OFTableName("GSUB");
  44. /** Linear threshold table. */
  45. public static final OFTableName LTSH = new OFTableName("LTSH");
  46. /** OS/2 and Windows specific metrics. */
  47. public static final OFTableName OS2 = new OFTableName("OS/2");
  48. /** PCL 5 data. */
  49. public static final OFTableName PCLT = new OFTableName("PCLT");
  50. /** Vertical Device Metrics table. */
  51. public static final OFTableName VDMX = new OFTableName("VDMX");
  52. /** Character to glyph mapping. */
  53. public static final OFTableName CMAP = new OFTableName("cmap");
  54. /** Control Value Table. */
  55. public static final OFTableName CVT = new OFTableName("cvt ");
  56. /** Font program. */
  57. public static final OFTableName FPGM = new OFTableName("fpgm");
  58. /** Grid-fitting and scan conversion procedure (grayscale). */
  59. public static final OFTableName GASP = new OFTableName("gasp");
  60. /** Glyph data. */
  61. public static final OFTableName GLYF = new OFTableName("glyf");
  62. /** Horizontal device metrics. */
  63. public static final OFTableName HDMX = new OFTableName("hdmx");
  64. /** Font header. */
  65. public static final OFTableName HEAD = new OFTableName("head");
  66. /** Horizontal header. */
  67. public static final OFTableName HHEA = new OFTableName("hhea");
  68. /** Horizontal metrics. */
  69. public static final OFTableName HMTX = new OFTableName("hmtx");
  70. /** Kerning. */
  71. public static final OFTableName KERN = new OFTableName("kern");
  72. /** Index to location. */
  73. public static final OFTableName LOCA = new OFTableName("loca");
  74. /** Maximum profile. */
  75. public static final OFTableName MAXP = new OFTableName("maxp");
  76. /** Naming table. */
  77. public static final OFTableName NAME = new OFTableName("name");
  78. /** PostScript information. */
  79. public static final OFTableName POST = new OFTableName("post");
  80. /** CVT Program. */
  81. public static final OFTableName PREP = new OFTableName("prep");
  82. /** Vertical Metrics header. */
  83. public static final OFTableName VHEA = new OFTableName("vhea");
  84. /** Vertical Metrics. */
  85. public static final OFTableName VMTX = new OFTableName("vmtx");
  86. private final String name;
  87. private OFTableName(String name) {
  88. this.name = name;
  89. }
  90. /**
  91. * Returns the name of the table as it should be in the Directory Table.
  92. */
  93. public String getName() {
  94. return name;
  95. }
  96. /**
  97. * Returns an instance of this class corresponding to the given string representation.
  98. * @param tableName table name as in the Table Directory
  99. * @return TTFTableName
  100. */
  101. public static OFTableName getValue(String tableName) {
  102. if (tableName != null) {
  103. return new OFTableName(tableName);
  104. }
  105. throw new IllegalArgumentException("A TrueType font table name must not be null");
  106. }
  107. @Override
  108. public int hashCode() {
  109. return name.hashCode();
  110. }
  111. @Override
  112. public boolean equals(Object o) {
  113. if (o == this) {
  114. return true;
  115. }
  116. if (!(o instanceof OFTableName)) {
  117. return false;
  118. }
  119. OFTableName to = (OFTableName) o;
  120. return this.name.equals(to.getName());
  121. }
  122. @Override
  123. public String toString() {
  124. return name;
  125. }
  126. }