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

org.jpedal.fonts.glyph.javafx.JavaFXSupportImpl Maven / Gradle / Ivy

/*
 * ===========================================
 * 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@
 *
 * ---------------
 * JavaFXSupportImpl.java
 * ---------------
 */
package org.jpedal.fonts.glyph.javafx;

import org.jpedal.javafx.JavaFXSupport;
import org.jpedal.fonts.glyph.PdfGlyph;
import org.jpedal.fonts.glyph.T1GlyphFX;
import org.jpedal.fonts.tt.*;
import org.jpedal.fonts.tt.hinting.TTVM;
import org.jpedal.objects.FXClip;
import org.jpedal.objects.JavaFXShape;
import org.jpedal.objects.PdfClip;
import org.jpedal.objects.PdfShape;

/**
 * @author markee
 */
public class JavaFXSupportImpl extends JavaFXSupport {

    public JavaFXSupportImpl() {
    }

    @Override
    public PdfGlyph getGlyph(final Glyf currentGlyf, final FontFile2 fontTable, final Hmtx currentHmtx, final int idx, final float unitsPerEm, final TTVM vm, final String baseFontName) {

        PdfGlyph currentGlyph;

        if (TTGlyph.useHinting) {
            currentGlyph = new TTGlyphFX(currentGlyf, fontTable, currentHmtx, idx, unitsPerEm, vm);

            if (currentGlyph.failedOnHinting()) {

                //some issue so use non-hinted version
                currentGlyph = new TTGlyphFX(currentGlyf, fontTable, currentHmtx, idx, unitsPerEm, baseFontName);
            }
        } else {
            currentGlyph = new TTGlyphFX(currentGlyf, fontTable, currentHmtx, idx, unitsPerEm, baseFontName);
        }

        return currentGlyph;
    }

    @Override
    public PdfGlyph getGlyph(final float[] x, final float[] y, final float[] x2, final float[] y2, final float[] x3, final float[] y3,
                             final float ymin, final int end, final int[] commands) {
        return new T1GlyphFX(x, y, x2, y2, x3, y3, ymin, end, commands);
    }

    @Override
    public PdfShape getFXShape() {
        return new JavaFXShape();
    }

    @Override
    public PdfClip getFXClip() {
        return new FXClip();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy