All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jpedal.fonts.tt.OS2 Maven / Gradle / Ivy

There is a newer version: 7.15.25
Show newest version
/*
 * ===========================================
 * Java Pdf Extraction Decoding Access Library
 * ===========================================
 *
 * Project Info:  http://www.idrsolutions.com
 * Help section for developers at http://www.idrsolutions.com/support/
 *
 * (C) Copyright 1997-2017 IDRsolutions and Contributors.
 *
 * This file is part of JPedal/JPDF2HTML5
 *
 @LICENSE@
 *
 * ---------------
 * OS2.java
 * ---------------
 */
package org.jpedal.fonts.tt;


public class OS2 extends Table {

    protected int version, xAvgCharWidth, usWeightClass, usWidthClass, fsType, yStrikeoutSize, yStrikeoutPosition, sFamilyClass,
            fsSelection, usFirstCharIndex, usLastCharIndex, sTypoAscender, sTypoDescender, sTypoLineGap, usWinAscent,
            usWinDescent, sxHeight, sCapHeight, usDefaultChar, usBreakChar, usMaxContext;
    protected final int[] subscriptData = new int[4];
    protected final int[] superscriptData = new int[4];
    protected final int[] panose = new int[10];
    protected final int[] ulUnicodeRange = new int[4];
    protected final int[] achVendID = new int[4];
    protected final int[] ulCodePageRange = new int[2];


    public OS2(final FontFile2 font) {
        final int baseOffset = font.getTableStart(FontFile2.OS2);

        final int pointer = font.getPointer();
        font.setPointer(baseOffset);

        version = font.getNextUint16();

        xAvgCharWidth = font.getNextInt16();
        usWeightClass = font.getNextUint16();
        usWidthClass = font.getNextInt16();
        fsType = font.getNextInt16();
        for (int i = 0; i < 4; i++) {
            subscriptData[i] = font.getNextInt16();
        }
        for (int i = 0; i < 4; i++) {
            superscriptData[i] = font.getNextInt16();
        }
        yStrikeoutSize = font.getNextInt16();
        yStrikeoutPosition = font.getNextInt16();
        sFamilyClass = font.getNextInt16();
        for (int i = 0; i < 10; i++) {
            panose[i] = font.getNextint8();
        }
        for (int i = 0; i < 4; i++) {
            ulUnicodeRange[i] = font.getNextUint32();
        }
        for (int i = 0; i < 4; i++) {
            achVendID[i] = font.getNextint8();
        }
        fsSelection = font.getNextUint16();
        usFirstCharIndex = font.getNextUint16();
        usLastCharIndex = font.getNextUint16();
        sTypoAscender = font.getNextInt16();
        sTypoDescender = font.getNextInt16();
        sTypoLineGap = font.getNextInt16();
        usWinAscent = font.getNextInt16();
        usWinDescent = font.getNextInt16();

        if (version > 0) {
            for (int i = 0; i < 2; i++) {
                ulCodePageRange[i] = font.getNextUint32();
            }
        }

        if (version > 1) {
            sxHeight = font.getNextInt16();
            sCapHeight = font.getNextInt16();
            usDefaultChar = font.getNextUint16();
            usBreakChar = font.getNextUint16();
            usMaxContext = font.getNextUint16();
        }

        font.setPointer(pointer);
    }

    public OS2() {

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy