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