private static void consume_Tf(GraphicsState graphicState, Stack stack, Resources resources) {
//        collectTokenFrequency(PdfOps.Tf_TOKEN);
        //graphicState.translate(-shift,0);
        //shift=0;
        float size = ((Number) stack.pop()).floatValue();
        Name name2 = (Name) stack.pop();
        // build the new font and initialize it.
        graphicState.getTextState().font = resources.getFont(name2.getName());
        // in the rare case that the font can't be found then we try and build
        // one so the document can be rendered in some shape or form.
        if (graphicState.getTextState().font == null ||
                graphicState.getTextState().font.getFont() == null){
            // turn on the old awt font engine, as we have a null font
            FontFactory fontFactory = FontFactory.getInstance();
            boolean awtState = fontFactory.isAwtFontSubstitution();
            fontFactory.setAwtFontSubstitution(true);
            // get the first pages resources, no need to lock the page, already locked.
            Resources res = resources.getLibrary().getCatalog().getPageTree().getPage(0,null).getResources();
            // try and get a font off the first page.
            Object pageFonts = res.getEntries().get("Font");
            if (pageFonts instanceof Hashtable){
                // get first font
                graphicState.getTextState().font =
                    (org.icepdf.core.pobjects.fonts.Font)resources.getLibrary()
                            .getObject(((Hashtable)pageFonts).elements().nextElement());
                // might get a null pointer but we'll get on on deriveFont too
                graphicState.getTextState().font.init();
            }
            // return factory to original state.
            fontFactory.setAwtFontSubstitution(awtState);
            // if no fonts found then we just bail and accept the null pointer
        }
        graphicState.getTextState().currentfont =
                graphicState.getTextState().font.getFont().deriveFont(size);
    }