Home » pdfbox-1.1.0-src » org.apache.fontbox.ttf » [javadoc | source]

    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   package org.apache.fontbox.ttf;
   18   
   19   import java.io.IOException;
   20   import java.util.Calendar;
   21   
   22   /**
   23    * A table in a true type font.
   24    * 
   25    * @author Ben Litchfield (ben@benlitchfield.com)
   26    * @version $Revision: 1.1 $
   27    */
   28   public class HeaderTable extends TTFTable
   29   {
   30       /**
   31        * Tag to identify this table.
   32        */
   33       public static final String TAG = "head";
   34       
   35       private float version;
   36       private float fontRevision;
   37       private long checkSumAdjustment;
   38       private long magicNumber;
   39       private int flags;
   40       private int unitsPerEm;
   41       private Calendar created;
   42       private Calendar modified;
   43       private short xMin;
   44       private short yMin;
   45       private short xMax;
   46       private short yMax;
   47       private int macStyle;
   48       private int lowestRecPPEM;
   49       private short fontDirectionHint;
   50       private short indexToLocFormat;
   51       private short glyphDataFormat;
   52       
   53       /**
   54        * This will read the required data from the stream.
   55        * 
   56        * @param ttf The font that is being read.
   57        * @param data The stream to read the data from.
   58        * @throws IOException If there is an error reading the data.
   59        */
   60       public void initData( TrueTypeFont ttf, TTFDataStream data ) throws IOException
   61       {
   62           version = data.read32Fixed();
   63           fontRevision = data.read32Fixed();
   64           checkSumAdjustment = data.readUnsignedInt();
   65           magicNumber = data.readUnsignedInt();
   66           flags = data.readUnsignedShort();
   67           unitsPerEm = data.readUnsignedShort();
   68           created = data.readInternationalDate();
   69           modified = data.readInternationalDate();
   70           xMin = data.readSignedShort();
   71           yMin = data.readSignedShort();
   72           xMax = data.readSignedShort();
   73           yMax = data.readSignedShort();
   74           macStyle = data.readUnsignedShort();
   75           lowestRecPPEM = data.readUnsignedShort();
   76           fontDirectionHint = data.readSignedShort();
   77           indexToLocFormat = data.readSignedShort();
   78           glyphDataFormat = data.readSignedShort();
   79       }
   80       /**
   81        * @return Returns the checkSumAdjustment.
   82        */
   83       public long getCheckSumAdjustment()
   84       {
   85           return checkSumAdjustment;
   86       }
   87       /**
   88        * @param checkSumAdjustmentValue The checkSumAdjustment to set.
   89        */
   90       public void setCheckSumAdjustment(long checkSumAdjustmentValue)
   91       {
   92           this.checkSumAdjustment = checkSumAdjustmentValue;
   93       }
   94       /**
   95        * @return Returns the created.
   96        */
   97       public Calendar getCreated()
   98       {
   99           return created;
  100       }
  101       /**
  102        * @param createdValue The created to set.
  103        */
  104       public void setCreated(Calendar createdValue)
  105       {
  106           this.created = createdValue;
  107       }
  108       /**
  109        * @return Returns the flags.
  110        */
  111       public int getFlags()
  112       {
  113           return flags;
  114       }
  115       /**
  116        * @param flagsValue The flags to set.
  117        */
  118       public void setFlags(int flagsValue)
  119       {
  120           this.flags = flagsValue;
  121       }
  122       /**
  123        * @return Returns the fontDirectionHint.
  124        */
  125       public short getFontDirectionHint()
  126       {
  127           return fontDirectionHint;
  128       }
  129       /**
  130        * @param fontDirectionHintValue The fontDirectionHint to set.
  131        */
  132       public void setFontDirectionHint(short fontDirectionHintValue)
  133       {
  134           this.fontDirectionHint = fontDirectionHintValue;
  135       }
  136       /**
  137        * @return Returns the fontRevision.
  138        */
  139       public float getFontRevision()
  140       {
  141           return fontRevision;
  142       }
  143       /**
  144        * @param fontRevisionValue The fontRevision to set.
  145        */
  146       public void setFontRevision(float fontRevisionValue)
  147       {
  148           this.fontRevision = fontRevisionValue;
  149       }
  150       /**
  151        * @return Returns the glyphDataFormat.
  152        */
  153       public short getGlyphDataFormat()
  154       {
  155           return glyphDataFormat;
  156       }
  157       /**
  158        * @param glyphDataFormatValue The glyphDataFormat to set.
  159        */
  160       public void setGlyphDataFormat(short glyphDataFormatValue)
  161       {
  162           this.glyphDataFormat = glyphDataFormatValue;
  163       }
  164       /**
  165        * @return Returns the indexToLocFormat.
  166        */
  167       public short getIndexToLocFormat()
  168       {
  169           return indexToLocFormat;
  170       }
  171       /**
  172        * @param indexToLocFormatValue The indexToLocFormat to set.
  173        */
  174       public void setIndexToLocFormat(short indexToLocFormatValue)
  175       {
  176           this.indexToLocFormat = indexToLocFormatValue;
  177       }
  178       /**
  179        * @return Returns the lowestRecPPEM.
  180        */
  181       public int getLowestRecPPEM()
  182       {
  183           return lowestRecPPEM;
  184       }
  185       /**
  186        * @param lowestRecPPEMValue The lowestRecPPEM to set.
  187        */
  188       public void setLowestRecPPEM(int lowestRecPPEMValue)
  189       {
  190           this.lowestRecPPEM = lowestRecPPEMValue;
  191       }
  192       /**
  193        * @return Returns the macStyle.
  194        */
  195       public int getMacStyle()
  196       {
  197           return macStyle;
  198       }
  199       /**
  200        * @param macStyleValue The macStyle to set.
  201        */
  202       public void setMacStyle(int macStyleValue)
  203       {
  204           this.macStyle = macStyleValue;
  205       }
  206       /**
  207        * @return Returns the magicNumber.
  208        */
  209       public long getMagicNumber()
  210       {
  211           return magicNumber;
  212       }
  213       /**
  214        * @param magicNumberValue The magicNumber to set.
  215        */
  216       public void setMagicNumber(long magicNumberValue)
  217       {
  218           this.magicNumber = magicNumberValue;
  219       }
  220       /**
  221        * @return Returns the modified.
  222        */
  223       public Calendar getModified()
  224       {
  225           return modified;
  226       }
  227       /**
  228        * @param modifiedValue The modified to set.
  229        */
  230       public void setModified(Calendar modifiedValue)
  231       {
  232           this.modified = modifiedValue;
  233       }
  234       /**
  235        * @return Returns the unitsPerEm.
  236        */
  237       public int getUnitsPerEm()
  238       {
  239           return unitsPerEm;
  240       }
  241       /**
  242        * @param unitsPerEmValue The unitsPerEm to set.
  243        */
  244       public void setUnitsPerEm(int unitsPerEmValue)
  245       {
  246           this.unitsPerEm = unitsPerEmValue;
  247       }
  248       /**
  249        * @return Returns the version.
  250        */
  251       public float getVersion()
  252       {
  253           return version;
  254       }
  255       /**
  256        * @param versionValue The version to set.
  257        */
  258       public void setVersion(float versionValue)
  259       {
  260           this.version = versionValue;
  261       }
  262       /**
  263        * @return Returns the xMax.
  264        */
  265       public short getXMax()
  266       {
  267           return xMax;
  268       }
  269       /**
  270        * @param maxValue The xMax to set.
  271        */
  272       public void setXMax(short maxValue)
  273       {
  274           xMax = maxValue;
  275       }
  276       /**
  277        * @return Returns the xMin.
  278        */
  279       public short getXMin()
  280       {
  281           return xMin;
  282       }
  283       /**
  284        * @param minValue The xMin to set.
  285        */
  286       public void setXMin(short minValue)
  287       {
  288           xMin = minValue;
  289       }
  290       /**
  291        * @return Returns the yMax.
  292        */
  293       public short getYMax()
  294       {
  295           return yMax;
  296       }
  297       /**
  298        * @param maxValue The yMax to set.
  299        */
  300       public void setYMax(short maxValue)
  301       {
  302           yMax = maxValue;
  303       }
  304       /**
  305        * @return Returns the yMin.
  306        */
  307       public short getYMin()
  308       {
  309           return yMin;
  310       }
  311       /**
  312        * @param minValue The yMin to set.
  313        */
  314       public void setYMin(short minValue)
  315       {
  316           yMin = minValue;
  317       }
  318   }

Home » pdfbox-1.1.0-src » org.apache.fontbox.ttf » [javadoc | source]