1. /*
  2. * @(#)OpenType.java 1.24 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.font;
  8. /**
  9. * The <code>OpenType</code> interface represents OpenType and
  10. * TrueType fonts. This interface makes it possible to obtain
  11. * <i>sfnt</i> tables from the font. A particular
  12. * <code>Font</code> object can implement this interface.
  13. * <p>
  14. * For more information on TrueType fonts, see the
  15. * Apple TrueType Reference Manual
  16. * ( <a href="http://fonts.apple.com/TTRefMan/index.html">http://fonts.apple.com/TTRefMan/index.html</a> ).
  17. * @version 10 Feb 1997
  18. */
  19. public interface OpenType {
  20. /* 51 tag types so far */
  21. /**
  22. * Character to glyph mapping. Table tag "cmap" in the Open
  23. * Type Specification.
  24. */
  25. public final static int TAG_CMAP = 0x636d6170;
  26. /**
  27. * Font header. Table tag "head" in the Open
  28. * Type Specification.
  29. */
  30. public final static int TAG_HEAD = 0x68656164;
  31. /**
  32. * Naming table. Table tag "name" in the Open
  33. * Type Specification.
  34. */
  35. public final static int TAG_NAME = 0x6e616d65;
  36. /**
  37. * Glyph data. Table tag "glyf" in the Open
  38. * Type Specification.
  39. */
  40. public final static int TAG_GLYF = 0x676c7966;
  41. /**
  42. * Maximum profile. Table tag "maxp" in the Open
  43. * Type Specification.
  44. */
  45. public final static int TAG_MAXP = 0x6d617870;
  46. /**
  47. * CVT preprogram. Table tag "prep" in the Open
  48. * Type Specification.
  49. */
  50. public final static int TAG_PREP = 0x70726570;
  51. /**
  52. * Horizontal metrics. Table tag "hmtx" in the Open
  53. * Type Specification.
  54. */
  55. public final static int TAG_HMTX = 0x686d7478;
  56. /**
  57. * Kerning. Table tag "kern" in the Open
  58. * Type Specification.
  59. */
  60. public final static int TAG_KERN = 0x6b65726e;
  61. /**
  62. * Horizontal device metrics. Table tag "hdmx" in the Open
  63. * Type Specification.
  64. */
  65. public final static int TAG_HDMX = 0x68646d78;
  66. /**
  67. * Index to location. Table tag "loca" in the Open
  68. * Type Specification.
  69. */
  70. public final static int TAG_LOCA = 0x6c6f6361;
  71. /**
  72. * PostScript Information. Table tag "post" in the Open
  73. * Type Specification.
  74. */
  75. public final static int TAG_POST = 0x706f7374;
  76. /**
  77. * OS/2 and Windows specific metrics. Table tag "OS/2"
  78. * in the Open Type Specification.
  79. */
  80. public final static int TAG_OS2 = 0x4f532f32;
  81. /**
  82. * Control value table. Table tag "cvt "
  83. * in the Open Type Specification.
  84. */
  85. public final static int TAG_CVT = 0x63767420;
  86. /**
  87. * Grid-fitting and scan conversion procedure. Table tag
  88. * "gasp" in the Open Type Specification.
  89. */
  90. public final static int TAG_GASP = 0x67617370;
  91. /**
  92. * Vertical device metrics. Table tag "VDMX" in the Open
  93. * Type Specification.
  94. */
  95. public final static int TAG_VDMX = 0x56444d58;
  96. /**
  97. * Vertical metrics. Table tag "vmtx" in the Open
  98. * Type Specification.
  99. */
  100. public final static int TAG_VMTX = 0x766d7478;
  101. /**
  102. * Vertical metrics header. Table tag "vhea" in the Open
  103. * Type Specification.
  104. */
  105. public final static int TAG_VHEA = 0x76686561;
  106. /**
  107. * Horizontal metrics header. Table tag "hhea" in the Open
  108. * Type Specification.
  109. */
  110. public final static int TAG_HHEA = 0x68686561;
  111. /**
  112. * Adobe Type 1 font data. Table tag "typ1" in the Open
  113. * Type Specification.
  114. */
  115. public final static int TAG_TYP1 = 0x74797031;
  116. /**
  117. * Baseline table. Table tag "bsln" in the Open
  118. * Type Specification.
  119. */
  120. public final static int TAG_BSLN = 0x62736c6e;
  121. /**
  122. * Glyph substitution. Table tag "GSUB" in the Open
  123. * Type Specification.
  124. */
  125. public final static int TAG_GSUB = 0x47535542;
  126. /**
  127. * Digital signature. Table tag "DSIG" in the Open
  128. * Type Specification.
  129. */
  130. public final static int TAG_DSIG = 0x44534947;
  131. /**
  132. * Font program. Table tag "fpgm" in the Open
  133. * Type Specification.
  134. */
  135. public final static int TAG_FPGM = 0x6670676d;
  136. /**
  137. * Font variation. Table tag "fvar" in the Open
  138. * Type Specification.
  139. */
  140. public final static int TAG_FVAR = 0x66766172;
  141. /**
  142. * Glyph variation. Table tag "gvar" in the Open
  143. * Type Specification.
  144. */
  145. public final static int TAG_GVAR = 0x67766172;
  146. /**
  147. * Compact font format (Type1 font). Table tag
  148. * "CFF " in the Open Type Specification.
  149. */
  150. public final static int TAG_CFF = 0x43464620;
  151. /**
  152. * Multiple master supplementary data. Table tag
  153. * "MMSD" in the Open Type Specification.
  154. */
  155. public final static int TAG_MMSD = 0x4d4d5344;
  156. /**
  157. * Multiple master font metrics. Table tag
  158. * "MMFX" in the Open Type Specification.
  159. */
  160. public final static int TAG_MMFX = 0x4d4d4658;
  161. /**
  162. * Baseline data. Table tag "BASE" in the Open
  163. * Type Specification.
  164. */
  165. public final static int TAG_BASE = 0x42415345;
  166. /**
  167. * Glyph definition. Table tag "GDEF" in the Open
  168. * Type Specification.
  169. */
  170. public final static int TAG_GDEF = 0x47444546;
  171. /**
  172. * Glyph positioning. Table tag "GPOS" in the Open
  173. * Type Specification.
  174. */
  175. public final static int TAG_GPOS = 0x47504f53;
  176. /**
  177. * Justification. Table tag "JSTF" in the Open
  178. * Type Specification.
  179. */
  180. public final static int TAG_JSTF = 0x4a535446;
  181. /**
  182. * Embedded bitmap data. Table tag "EBDT" in the Open
  183. * Type Specification.
  184. */
  185. public final static int TAG_EBDT = 0x45424454;
  186. /**
  187. * Embedded bitmap location. Table tag "EBLC" in the Open
  188. * Type Specification.
  189. */
  190. public final static int TAG_EBLC = 0x45424c43;
  191. /**
  192. * Embedded bitmap scaling. Table tag "EBSC" in the Open
  193. * Type Specification.
  194. */
  195. public final static int TAG_EBSC = 0x45425343;
  196. /**
  197. * Linear threshold. Table tag "LTSH" in the Open
  198. * Type Specification.
  199. */
  200. public final static int TAG_LTSH = 0x4c545348;
  201. /**
  202. * PCL 5 data. Table tag "PCLT" in the Open
  203. * Type Specification.
  204. */
  205. public final static int TAG_PCLT = 0x50434c54;
  206. /**
  207. * Accent attachment. Table tag "acnt" in the Open
  208. * Type Specification.
  209. */
  210. public final static int TAG_ACNT = 0x61636e74;
  211. /**
  212. * Axis variaiton. Table tag "avar" in the Open
  213. * Type Specification.
  214. */
  215. public final static int TAG_AVAR = 0x61766172;
  216. /**
  217. * Bitmap data. Table tag "bdat" in the Open
  218. * Type Specification.
  219. */
  220. public final static int TAG_BDAT = 0x62646174;
  221. /**
  222. * Bitmap location. Table tag "bloc" in the Open
  223. * Type Specification.
  224. */
  225. public final static int TAG_BLOC = 0x626c6f63;
  226. /**
  227. * CVT variation. Table tag "cvar" in the Open
  228. * Type Specification.
  229. */
  230. public final static int TAG_CVAR = 0x63766172;
  231. /**
  232. * Feature name. Table tag "feat" in the Open
  233. * Type Specification.
  234. */
  235. public final static int TAG_FEAT = 0x66656174;
  236. /**
  237. * Font descriptors. Table tag "fdsc" in the Open
  238. * Type Specification.
  239. */
  240. public final static int TAG_FDSC = 0x66647363;
  241. /**
  242. * Font metrics. Table tag "fmtx" in the Open
  243. * Type Specification.
  244. */
  245. public final static int TAG_FMTX = 0x666d7478;
  246. /**
  247. * Justification. Table tag "just" in the Open
  248. * Type Specification.
  249. */
  250. public final static int TAG_JUST = 0x6a757374;
  251. /**
  252. * Ligature caret. Table tag "lcar" in the Open
  253. * Type Specification.
  254. */
  255. public final static int TAG_LCAR = 0x6c636172;
  256. /**
  257. * Glyph metamorphosis. Table tag "mort" in the Open
  258. * Type Specification.
  259. */
  260. public final static int TAG_MORT = 0x6d6f7274;
  261. /**
  262. * Optical bounds. Table tag "opbd" in the Open
  263. * Type Specification.
  264. */
  265. public final static int TAG_OPBD = 0x6d6f7274;
  266. /**
  267. * Glyph properties. Table tag "prop" in the Open
  268. * Type Specification.
  269. */
  270. public final static int TAG_PROP = 0x70726f70;
  271. /**
  272. * Tracking. Table tag "trak" in the Open
  273. * Type Specification.
  274. */
  275. public final static int TAG_TRAK = 0x7472616b;
  276. /**
  277. * Returns the version of the <code>OpenType</code> font.
  278. * 1.0 is represented as 0x00010000.
  279. * @return the version of the <code>OpenType</code> font.
  280. */
  281. public int getVersion();
  282. /**
  283. * Returns the table as an array of bytes for a specified tag.
  284. * Tags for sfnt tables include items like <i>cmap</i>,
  285. * <i>name</i> and <i>head</i>. The <code>byte</code> array
  286. * returned is a copy of the font data in memory.
  287. * @param sfntTag a four-character code as a 32-bit integer
  288. * @return a <code>byte</code> array that is the table that
  289. * contains the font data corresponding to the specified
  290. * tag.
  291. */
  292. public byte[] getFontTable(int sfntTag);
  293. /**
  294. * Returns the table as an array of bytes for a specified tag.
  295. * Tags for sfnt tables include items like <i>cmap</i>,
  296. * <i>name</i> and <i>head</i>. The byte array returned is a
  297. * copy of the font data in memory.
  298. * @param strSfntTag a four-character code as a
  299. * <code>String</code>
  300. * @return a <code>byte</code> array that is the table that
  301. * contains the font data corresponding to the specified
  302. * tag.
  303. */
  304. public byte[] getFontTable(String strSfntTag);
  305. /**
  306. * Returns a subset of the table as an array of bytes
  307. * for a specified tag. Tags for sfnt tables include
  308. * items like <i>cmap</i>, <i>name</i> and <i>head</i>.
  309. * The byte array returned is a copy of the font data in
  310. * memory.
  311. * @param sfntTag a four-character code as a 32-bit integer
  312. * @param offset index of first byte to return from table
  313. * @param count number of bytes to return from table
  314. * @return a subset of the table corresponding to
  315. * <code>sfntTag</code> and containing the bytes
  316. * starting at <code>offset</code> byte and including
  317. * <code>count</code> bytes.
  318. */
  319. public byte[] getFontTable(int sfntTag, int offset, int count);
  320. /**
  321. * Returns a subset of the table as an array of bytes
  322. * for a specified tag. Tags for sfnt tables include items
  323. * like <i>cmap</i>, <i>name</i> and <i>head</i>. The
  324. * <code>byte</code> array returned is a copy of the font
  325. * data in memory.
  326. * @param strSfntTag a four-character code as a
  327. * <code>String</code>
  328. * @param offset index of first byte to return from table
  329. * @param count number of bytes to return from table
  330. * @return a subset of the table corresponding to
  331. * <code>strSfntTag</code> and containing the bytes
  332. * starting at <code>offset</code> byte and including
  333. * <code>count</code> bytes.
  334. */
  335. public byte[] getFontTable(String strSfntTag, int offset, int count);
  336. /**
  337. * Returns the size of the table for a specified tag. Tags for sfnt
  338. * tables include items like <i>cmap</i>, <i>name</i> and <i>head</i>.
  339. * @param sfntTag a four-character code as a 32-bit integer
  340. * @return the size of the table corresponding to the specified
  341. * tag.
  342. */
  343. public int getFontTableSize(int sfntTag);
  344. /**
  345. * Returns the size of the table for a specified tag. Tags for sfnt
  346. * tables include items like <i>cmap</i>, <i>name</i> and <i>head</i>.
  347. * @param strSfntTag a four-character code as a
  348. * <code>String</code>
  349. * @return the size of the table corresponding to the specified tag.
  350. */
  351. public int getFontTableSize(String strSfntTag);
  352. }