1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   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 final static int       TAG_CMAP        = 0x636d6170;
  47 
  48   /**
  49    * Font header.  Table tag "head" in the Open
  50    * Type Specification.
  51    */
  52   public final static int       TAG_HEAD        = 0x68656164;
  53 
  54   /**
  55    * Naming table.  Table tag "name" in the Open
  56    * Type Specification.
  57    */
  58   public final static int       TAG_NAME        = 0x6e616d65;
  59 
  60   /**
  61    * Glyph data.  Table tag "glyf" in the Open
  62    * Type Specification.
  63    */
  64   public final static int       TAG_GLYF        = 0x676c7966;
  65 
  66   /**
  67    * Maximum profile.  Table tag "maxp" in the Open
  68    * Type Specification.
  69    */
  70   public final static int       TAG_MAXP        = 0x6d617870;
  71 
  72   /**
  73    * CVT preprogram.  Table tag "prep" in the Open
  74    * Type Specification.
  75    */
  76   public final static int       TAG_PREP        = 0x70726570;
  77 
  78   /**
  79    * Horizontal metrics.  Table tag "hmtx" in the Open
  80    * Type Specification.
  81    */
  82   public final static int       TAG_HMTX        = 0x686d7478;
  83 
  84   /**
  85    * Kerning.  Table tag "kern" in the Open
  86    * Type Specification.
  87    */
  88   public final static int       TAG_KERN        = 0x6b65726e;
  89 
  90   /**
  91    * Horizontal device metrics.  Table tag "hdmx" in the Open
  92    * Type Specification.
  93    */
  94   public final static int       TAG_HDMX        = 0x68646d78;
  95 
  96   /**
  97    * Index to location.  Table tag "loca" in the Open
  98    * Type Specification.
  99    */
 100   public final static int       TAG_LOCA        = 0x6c6f6361;
 101 
 102   /**
 103    * PostScript Information.  Table tag "post" in the Open
 104    * Type Specification.
 105    */
 106   public final static int       TAG_POST        = 0x706f7374;
 107 
 108   /**
 109    * OS/2 and Windows specific metrics.  Table tag "OS/2"
 110    * in the Open Type Specification.
 111    */
 112   public final static int       TAG_OS2 = 0x4f532f32;
 113 
 114   /**
 115    * Control value table.  Table tag "cvt "
 116    * in the Open Type Specification.
 117    */
 118   public final static int       TAG_CVT = 0x63767420;
 119 
 120   /**
 121    * Grid-fitting and scan conversion procedure.  Table tag
 122    * "gasp" in the Open Type Specification.
 123    */
 124   public final static int       TAG_GASP        = 0x67617370;
 125 
 126   /**
 127    * Vertical device metrics.  Table tag "VDMX" in the Open
 128    * Type Specification.
 129    */
 130   public final static int       TAG_VDMX        = 0x56444d58;
 131 
 132   /**
 133    * Vertical metrics.  Table tag "vmtx" in the Open
 134    * Type Specification.
 135    */
 136   public final static int       TAG_VMTX        = 0x766d7478;
 137 
 138   /**
 139    * Vertical metrics header.  Table tag "vhea" in the Open
 140    * Type Specification.
 141    */
 142   public final static int       TAG_VHEA        = 0x76686561;
 143 
 144   /**
 145    * Horizontal metrics header.  Table tag "hhea" in the Open
 146    * Type Specification.
 147    */
 148   public final static int       TAG_HHEA        = 0x68686561;
 149 
 150   /**
 151    * Adobe Type 1 font data.  Table tag "typ1" in the Open
 152    * Type Specification.
 153    */
 154   public final static int       TAG_TYP1        = 0x74797031;
 155 
 156   /**
 157    * Baseline table.  Table tag "bsln" in the Open
 158    * Type Specification.
 159    */
 160   public final static int       TAG_BSLN        = 0x62736c6e;
 161 
 162   /**
 163    * Glyph substitution.  Table tag "GSUB" in the Open
 164    * Type Specification.
 165    */
 166   public final static int       TAG_GSUB        = 0x47535542;
 167 
 168   /**
 169    * Digital signature.  Table tag "DSIG" in the Open
 170    * Type Specification.
 171    */
 172   public final static int       TAG_DSIG        = 0x44534947;
 173 
 174   /**
 175    * Font program.   Table tag "fpgm" in the Open
 176    * Type Specification.
 177    */
 178   public final static int       TAG_FPGM        = 0x6670676d;
 179 
 180   /**
 181    * Font variation.   Table tag "fvar" in the Open
 182    * Type Specification.
 183    */
 184   public final static int       TAG_FVAR        = 0x66766172;
 185 
 186   /**
 187    * Glyph variation.  Table tag "gvar" in the Open
 188    * Type Specification.
 189    */
 190   public final static int       TAG_GVAR        = 0x67766172;
 191 
 192   /**
 193    * Compact font format (Type1 font).  Table tag
 194    * "CFF " in the Open Type Specification.
 195    */
 196   public final static int       TAG_CFF = 0x43464620;
 197 
 198   /**
 199    * Multiple master supplementary data.  Table tag
 200    * "MMSD" in the Open Type Specification.
 201    */
 202   public final static int       TAG_MMSD        = 0x4d4d5344;
 203 
 204   /**
 205    * Multiple master font metrics.  Table tag
 206    * "MMFX" in the Open Type Specification.
 207    */
 208   public final static int       TAG_MMFX        = 0x4d4d4658;
 209 
 210   /**
 211    * Baseline data.  Table tag "BASE" in the Open
 212    * Type Specification.
 213    */
 214   public final static int       TAG_BASE        = 0x42415345;
 215 
 216   /**
 217    * Glyph definition.  Table tag "GDEF" in the Open
 218    * Type Specification.
 219    */
 220   public final static int       TAG_GDEF        = 0x47444546;
 221 
 222   /**
 223    * Glyph positioning.  Table tag "GPOS" in the Open
 224    * Type Specification.
 225    */
 226   public final static int       TAG_GPOS        = 0x47504f53;
 227 
 228   /**
 229    * Justification.  Table tag "JSTF" in the Open
 230    * Type Specification.
 231    */
 232   public final static int       TAG_JSTF        = 0x4a535446;
 233 
 234   /**
 235    * Embedded bitmap data.  Table tag "EBDT" in the Open
 236    * Type Specification.
 237    */
 238   public final static int       TAG_EBDT        = 0x45424454;
 239 
 240   /**
 241    * Embedded bitmap location.  Table tag "EBLC" in the Open
 242    * Type Specification.
 243    */
 244   public final static int       TAG_EBLC        = 0x45424c43;
 245 
 246   /**
 247    * Embedded bitmap scaling.  Table tag "EBSC" in the Open
 248    * Type Specification.
 249    */
 250   public final static int       TAG_EBSC        = 0x45425343;
 251 
 252   /**
 253    * Linear threshold.  Table tag "LTSH" in the Open
 254    * Type Specification.
 255    */
 256   public final static int       TAG_LTSH        = 0x4c545348;
 257 
 258   /**
 259    * PCL 5 data.  Table tag "PCLT" in the Open
 260    * Type Specification.
 261    */
 262   public final static int       TAG_PCLT        = 0x50434c54;
 263 
 264   /**
 265    * Accent attachment.  Table tag "acnt" in the Open
 266    * Type Specification.
 267    */
 268   public final static int       TAG_ACNT        = 0x61636e74;
 269 
 270   /**
 271    * Axis variation.  Table tag "avar" in the Open
 272    * Type Specification.
 273    */
 274   public final static int       TAG_AVAR        = 0x61766172;
 275 
 276   /**
 277    * Bitmap data.  Table tag "bdat" in the Open
 278    * Type Specification.
 279    */
 280   public final static int       TAG_BDAT        = 0x62646174;
 281 
 282   /**
 283    * Bitmap location.  Table tag "bloc" in the Open
 284    * Type Specification.
 285    */
 286   public final static int       TAG_BLOC        = 0x626c6f63;
 287 
 288    /**
 289     * CVT variation.  Table tag "cvar" in the Open
 290     * Type Specification.
 291     */
 292   public final static int       TAG_CVAR        = 0x63766172;
 293 
 294   /**
 295    * Feature name.  Table tag "feat" in the Open
 296     * Type Specification.
 297    */
 298   public final static int       TAG_FEAT        = 0x66656174;
 299 
 300   /**
 301    * Font descriptors.  Table tag "fdsc" in the Open
 302    * Type Specification.
 303    */
 304   public final static int       TAG_FDSC        = 0x66647363;
 305 
 306   /**
 307    * Font metrics.  Table tag "fmtx" in the Open
 308    * Type Specification.
 309    */
 310   public final static int       TAG_FMTX        = 0x666d7478;
 311 
 312   /**
 313    * Justification.  Table tag "just" in the Open
 314    * Type Specification.
 315    */
 316   public final static int       TAG_JUST        = 0x6a757374;
 317 
 318   /**
 319    * Ligature caret.   Table tag "lcar" in the Open
 320    * Type Specification.
 321    */
 322   public final static int       TAG_LCAR        = 0x6c636172;
 323 
 324   /**
 325    * Glyph metamorphosis.  Table tag "mort" in the Open
 326    * Type Specification.
 327    */
 328   public final static int       TAG_MORT        = 0x6d6f7274;
 329 
 330   /**
 331    * Optical bounds.  Table tag "opbd" in the Open
 332    * Type Specification.
 333    */
 334   public final static int       TAG_OPBD        = 0x6F706264;
 335 
 336   /**
 337    * Glyph properties.  Table tag "prop" in the Open
 338    * Type Specification.
 339    */
 340   public final static int       TAG_PROP        = 0x70726f70;
 341 
 342   /**
 343    * Tracking.  Table tag "trak" in the Open
 344    * Type Specification.
 345    */
 346   public final static 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 }