9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt.font; 27 28 /** 29 * The <code>OpenType</code> interface represents OpenType and 30 * TrueType fonts. This interface makes it possible to obtain 31 * <i>sfnt</i> tables from the font. A particular 32 * <code>Font</code> object can implement this interface. 33 * <p> 34 * For more information on TrueType and OpenType fonts, see the 35 * OpenType specification. 36 * ( <a href="http://www.microsoft.com/typography/otspec/">http://www.microsoft.com/typography/otspec/</a> ). 37 */ 38 public interface OpenType { 39 40 /* 51 tag types so far */ 41 42 /** 43 * Character to glyph mapping. Table tag "cmap" in the Open 44 * Type Specification. 45 */ 46 public static final int TAG_CMAP = 0x636d6170; 47 48 /** 49 * Font header. Table tag "head" in the Open 50 * Type Specification. 51 */ 52 public static final int TAG_HEAD = 0x68656164; 329 330 /** 331 * Optical bounds. Table tag "opbd" in the Open 332 * Type Specification. 333 */ 334 public static final int TAG_OPBD = 0x6F706264; 335 336 /** 337 * Glyph properties. Table tag "prop" in the Open 338 * Type Specification. 339 */ 340 public static final int TAG_PROP = 0x70726f70; 341 342 /** 343 * Tracking. Table tag "trak" in the Open 344 * Type Specification. 345 */ 346 public static final int TAG_TRAK = 0x7472616b; 347 348 /** 349 * Returns the version of the <code>OpenType</code> font. 350 * 1.0 is represented as 0x00010000. 351 * @return the version of the <code>OpenType</code> font. 352 */ 353 public int getVersion(); 354 355 /** 356 * Returns the table as an array of bytes for a specified tag. 357 * Tags for sfnt tables include items like <i>cmap</i>, 358 * <i>name</i> and <i>head</i>. The <code>byte</code> array 359 * returned is a copy of the font data in memory. 360 * @param sfntTag a four-character code as a 32-bit integer 361 * @return a <code>byte</code> array that is the table that 362 * contains the font data corresponding to the specified 363 * tag. 364 */ 365 public byte[] getFontTable(int sfntTag); 366 367 /** 368 * Returns the table as an array of bytes for a specified tag. 369 * Tags for sfnt tables include items like <i>cmap</i>, 370 * <i>name</i> and <i>head</i>. The byte array returned is a 371 * copy of the font data in memory. 372 * @param strSfntTag a four-character code as a 373 * <code>String</code> 374 * @return a <code>byte</code> array that is the table that 375 * contains the font data corresponding to the specified 376 * tag. 377 */ 378 public byte[] getFontTable(String strSfntTag); 379 380 /** 381 * Returns a subset of the table as an array of bytes 382 * for a specified tag. Tags for sfnt tables include 383 * items like <i>cmap</i>, <i>name</i> and <i>head</i>. 384 * The byte array returned is a copy of the font data in 385 * memory. 386 * @param sfntTag a four-character code as a 32-bit integer 387 * @param offset index of first byte to return from table 388 * @param count number of bytes to return from table 389 * @return a subset of the table corresponding to 390 * <code>sfntTag</code> and containing the bytes 391 * starting at <code>offset</code> byte and including 392 * <code>count</code> bytes. 393 */ 394 public byte[] getFontTable(int sfntTag, int offset, int count); 395 396 /** 397 * Returns a subset of the table as an array of bytes 398 * for a specified tag. Tags for sfnt tables include items 399 * like <i>cmap</i>, <i>name</i> and <i>head</i>. The 400 * <code>byte</code> array returned is a copy of the font 401 * data in memory. 402 * @param strSfntTag a four-character code as a 403 * <code>String</code> 404 * @param offset index of first byte to return from table 405 * @param count number of bytes to return from table 406 * @return a subset of the table corresponding to 407 * <code>strSfntTag</code> and containing the bytes 408 * starting at <code>offset</code> byte and including 409 * <code>count</code> bytes. 410 */ 411 public byte[] getFontTable(String strSfntTag, int offset, int count); 412 413 /** 414 * Returns the size of the table for a specified tag. Tags for sfnt 415 * tables include items like <i>cmap</i>, <i>name</i> and <i>head</i>. 416 * @param sfntTag a four-character code as a 32-bit integer 417 * @return the size of the table corresponding to the specified 418 * tag. 419 */ 420 public int getFontTableSize(int sfntTag); 421 422 /** 423 * Returns the size of the table for a specified tag. Tags for sfnt 424 * tables include items like <i>cmap</i>, <i>name</i> and <i>head</i>. 425 * @param strSfntTag a four-character code as a 426 * <code>String</code> 427 * @return the size of the table corresponding to the specified tag. 428 */ 429 public int getFontTableSize(String strSfntTag); 430 431 432 } | 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt.font; 27 28 /** 29 * The {@code OpenType} interface represents OpenType and 30 * TrueType fonts. This interface makes it possible to obtain 31 * <i>sfnt</i> tables from the font. A particular 32 * {@code Font} object can implement this interface. 33 * <p> 34 * For more information on TrueType and OpenType fonts, see the 35 * OpenType specification. 36 * ( <a href="http://www.microsoft.com/typography/otspec/">http://www.microsoft.com/typography/otspec/</a> ). 37 */ 38 public interface OpenType { 39 40 /* 51 tag types so far */ 41 42 /** 43 * Character to glyph mapping. Table tag "cmap" in the Open 44 * Type Specification. 45 */ 46 public static final int TAG_CMAP = 0x636d6170; 47 48 /** 49 * Font header. Table tag "head" in the Open 50 * Type Specification. 51 */ 52 public static final int TAG_HEAD = 0x68656164; 329 330 /** 331 * Optical bounds. Table tag "opbd" in the Open 332 * Type Specification. 333 */ 334 public static final int TAG_OPBD = 0x6F706264; 335 336 /** 337 * Glyph properties. Table tag "prop" in the Open 338 * Type Specification. 339 */ 340 public static final int TAG_PROP = 0x70726f70; 341 342 /** 343 * Tracking. Table tag "trak" in the Open 344 * Type Specification. 345 */ 346 public static final int TAG_TRAK = 0x7472616b; 347 348 /** 349 * Returns the version of the {@code OpenType} font. 350 * 1.0 is represented as 0x00010000. 351 * @return the version of the {@code OpenType} font. 352 */ 353 public int getVersion(); 354 355 /** 356 * Returns the table as an array of bytes for a specified tag. 357 * Tags for sfnt tables include items like <i>cmap</i>, 358 * <i>name</i> and <i>head</i>. The {@code byte} array 359 * returned is a copy of the font data in memory. 360 * @param sfntTag a four-character code as a 32-bit integer 361 * @return a {@code byte} array that is the table that 362 * contains the font data corresponding to the specified 363 * tag. 364 */ 365 public byte[] getFontTable(int sfntTag); 366 367 /** 368 * Returns the table as an array of bytes for a specified tag. 369 * Tags for sfnt tables include items like <i>cmap</i>, 370 * <i>name</i> and <i>head</i>. The byte array returned is a 371 * copy of the font data in memory. 372 * @param strSfntTag a four-character code as a 373 * {@code String} 374 * @return a {@code byte} array that is the table that 375 * contains the font data corresponding to the specified 376 * tag. 377 */ 378 public byte[] getFontTable(String strSfntTag); 379 380 /** 381 * Returns a subset of the table as an array of bytes 382 * for a specified tag. Tags for sfnt tables include 383 * items like <i>cmap</i>, <i>name</i> and <i>head</i>. 384 * The byte array returned is a copy of the font data in 385 * memory. 386 * @param sfntTag a four-character code as a 32-bit integer 387 * @param offset index of first byte to return from table 388 * @param count number of bytes to return from table 389 * @return a subset of the table corresponding to 390 * {@code sfntTag} and containing the bytes 391 * starting at {@code offset} byte and including 392 * {@code count} bytes. 393 */ 394 public byte[] getFontTable(int sfntTag, int offset, int count); 395 396 /** 397 * Returns a subset of the table as an array of bytes 398 * for a specified tag. Tags for sfnt tables include items 399 * like <i>cmap</i>, <i>name</i> and <i>head</i>. The 400 * {@code byte} array returned is a copy of the font 401 * data in memory. 402 * @param strSfntTag a four-character code as a 403 * {@code String} 404 * @param offset index of first byte to return from table 405 * @param count number of bytes to return from table 406 * @return a subset of the table corresponding to 407 * {@code strSfntTag} and containing the bytes 408 * starting at {@code offset} byte and including 409 * {@code count} bytes. 410 */ 411 public byte[] getFontTable(String strSfntTag, int offset, int count); 412 413 /** 414 * Returns the size of the table for a specified tag. Tags for sfnt 415 * tables include items like <i>cmap</i>, <i>name</i> and <i>head</i>. 416 * @param sfntTag a four-character code as a 32-bit integer 417 * @return the size of the table corresponding to the specified 418 * tag. 419 */ 420 public int getFontTableSize(int sfntTag); 421 422 /** 423 * Returns the size of the table for a specified tag. Tags for sfnt 424 * tables include items like <i>cmap</i>, <i>name</i> and <i>head</i>. 425 * @param strSfntTag a four-character code as a 426 * {@code String} 427 * @return the size of the table corresponding to the specified tag. 428 */ 429 public int getFontTableSize(String strSfntTag); 430 431 432 } |