What Is fop.jar in fop-2.7-bin.zip

What Is fop.jar? I got it from the fop-2.7-bin.zip.

✍: FYIcenter.com

fop.jar in fop-2.7-bin.zip is the JAR file for FOP 2.7, which is a print formatter driven by XSL formatting objects (XSL-FO). You can obtain fop.jar from the build folder of the fop-2.7-bin.zip file.

Below is the information about the fop.jar (2.2) file:

JAR File Size and Download Location:

JAR name: fop.jar, fop-2.7.jar
Target JDK version: 1.7
File name: fop.jar
File size: 4442817 bytes
Release date: 20-Jan-2022
Download: Apache FOP Website

Java source code files for fop.jar:


 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *      http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

/* $Id: GlyfTable.java 1695082 2015-08-10 14:15:48Z rmeyer $ */

package org.apache.fop.fonts.truetype;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

 * This "glyf" table in a TrueType font file contains information that describes the glyphs. This
 * class is responsible for creating a subset of the "glyf" table given a set of glyph indices.
public class GlyfTable {

    private final OFMtxEntry[] mtxTab;

    private final long tableOffset;

    private final Set<Long> remappedComposites;

    protected final Map<Integer, Integer> subset;

    private final FontFileReader in;

    /** All the composite glyphs that appear in the subset. */
    private Set<Integer> compositeGlyphs = new TreeSet<Integer>();

    /** All the glyphs that are composed, but do not appear in the subset. */
    protected Set<Integer> composedGlyphs = new TreeSet<Integer>();

    public GlyfTable(FontFileReader in, OFMtxEntry[] metrics, OFDirTabEntry dirTableEntry,
                        Map<Integer, Integer> glyphs) throws IOException {
        mtxTab = metrics;
        tableOffset = dirTableEntry.getOffset();
        remappedComposites = new HashSet<Long>();
        this.subset = glyphs;
        this.in = in;

    private static enum GlyfFlags {

        ARG_1_AND_2_ARE_WORDS(4, 2),

        private final int bitMask;
        private final int argsCountIfSet;
        private final int argsCountIfNotSet;

        private GlyfFlags(int argsCountIfSet, int argsCountIfNotSet) {
            this.bitMask = 1 << this.ordinal();
            this.argsCountIfSet = argsCountIfSet;
            this.argsCountIfNotSet = argsCountIfNotSet;

        private GlyfFlags(int argsCountIfSet) {
            this(argsCountIfSet, 0);

        private GlyfFlags() {
            this(0, 0);

         * Calculates, from the given flags, the offset to the next glyph index.
         * @param flags the glyph data flags
         * @return offset to the next glyph if any, or 0
        static int getOffsetToNextComposedGlyf(int flags) {
            int offset = 0;
            for (GlyfFlags flag : GlyfFlags.values()) {
                offset += (flags & flag.bitMask) > 0 ? flag.argsCountIfSet : flag.argsCountIfNotSet;
            return offset;

         * Checks the given flags to see if there is another composed glyph.
         * @param flags the glyph data flags
         * @return true if there is another composed glyph, otherwise false.
        static boolean hasMoreComposites(int flags) {
            return (flags & MORE_COMPONENTS.bitMask) > 0;

     * Populates the map of subset glyphs with all the glyphs that compose the glyphs in the subset.
     * This also re-maps the indices of composed glyphs to their new index in the subset font.
     * @throws IOException an I/O error
    protected void populateGlyphsWithComposites() throws IOException {
        for (int indexInOriginal : subset.keySet()) {


        for (int compositeGlyph : compositeGlyphs) {
            long offset = tableOffset + mtxTab[compositeGlyph].getOffset() + 10;
            if (!remappedComposites.contains(offset)) {

     * Scans each glyph for any composed glyphs. This populates <code>compositeGlyphs</code> with
     * all the composite glyphs being used in the subset. This also populates <code>newGlyphs</code>
     * with any new glyphs that are composed and do not appear in the subset of glyphs.
     * For example the double quote mark (") is often composed of two apostrophes ('), if an
     * apostrophe doesn't appear in the glyphs in the subset, it will be included and will be added
     * to newGlyphs.
     * @param indexInOriginal the index of the glyph to test from the original font
     * @throws IOException an I/O error
    private void scanGlyphsRecursively(int indexInOriginal) throws IOException {
        if (!subset.containsKey(indexInOriginal)) {

        if (isComposite(indexInOriginal)) {
            Set<Integer> composedGlyphs = retrieveComposedGlyphs(indexInOriginal);
            for (Integer composedGlyph : composedGlyphs) {

     * Adds to the subset, all the glyphs that are composed by a glyph, but do not appear themselves
     * in the subset.
    protected void addAllComposedGlyphsToSubset() {
        int newIndex = subset.size();
        for (int composedGlyph : composedGlyphs) {
            subset.put(composedGlyph, newIndex++);

     * Re-maps the index of composed glyphs in the original font to the index of the same glyph in
     * the subset font.
     * @param glyphOffset the offset of the composite glyph
     * @throws IOException an I/O error
    private void remapComposite(long glyphOffset) throws IOException {
        long currentGlyphOffset = glyphOffset;


        int flags = 0;
        do {
            flags = in.readTTFUShort(currentGlyphOffset);
            int glyphIndex = in.readTTFUShort(currentGlyphOffset + 2);
            Integer indexInSubset = subset.get(glyphIndex);
            assert indexInSubset != null;
             * TODO: this should not be done here!! We're writing to the stream we're reading from,
             * this is asking for trouble! What should happen is when the glyph data is copied from
             * subset, the remapping should be done there. So the original stream is left untouched.
            in.writeTTFUShort(currentGlyphOffset + 2, indexInSubset);

            currentGlyphOffset += 4 + GlyfFlags.getOffsetToNextComposedGlyf(flags);
        } while (GlyfFlags.hasMoreComposites(flags));

    public boolean isComposite(int indexInOriginal) throws IOException {
        int numberOfContours = in.readTTFShort(tableOffset + mtxTab[indexInOriginal].getOffset());
        return numberOfContours < 0;

     * Reads a composite glyph at a given index and retrieves all the glyph indices of contingent
     * composed glyphs.
     * @param indexInOriginal the glyph index of the composite glyph
     * @return the set of glyph indices this glyph composes
     * @throws IOException an I/O error
    public Set<Integer> retrieveComposedGlyphs(int indexInOriginal)
            throws IOException {
        Set<Integer> composedGlyphs = new HashSet<Integer>();
        long offset = tableOffset + mtxTab[indexInOriginal].getOffset() + 10;
        int flags = 0;
        do {
            flags = in.readTTFUShort(offset);
            composedGlyphs.add(in.readTTFUShort(offset + 2));
            offset += 4 + GlyfFlags.getOffsetToNextComposedGlyf(flags);
        } while (GlyfFlags.hasMoreComposites(flags));

        return composedGlyphs;



Or download all of them as a single archive file:

File name: fop-2.7-src.zip
File size: 3401312 bytes
Release date: 2022-01-20


"fop" Command in fop-2.7-bin.zip

What Is fop-2.7-bin.zip

Download and Installing of FOP 2.x

⇑⇑ FAQ for FOP (Formatting Object Processor)

2016-07-07, 7306👍, 0💬