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.

TTFTableName.java 5.3KB

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