コード例 #1
0
        /**
         * Returns the value for a parameter.
         */
        public double get_value(String name, @Optional double modifier)
        {
            if ("ascender".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getAscender());
                }
                else
                {
                    return(0);
                }
            }
            else if ("capheight".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getCapHeight());
                }
                else
                {
                    return(0);
                }
            }
            else if ("descender".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getDescender());
                }
                else
                {
                    return(0);
                }
            }
            else if ("fontsize".equals(name))
            {
                return(_stream.getFontSize());
            }
            else
            {
                return(0);
            }
        }
コード例 #2
0
        PDFStream(int id)
        {
            _id = id;

            _tempStream = new TempStream();
            _tempStream.openWrite();
            _out.init(_tempStream);

            _procSet = new PDFProcSet();
            _procSet.add("/PDF");

            _font           = null;
            _inText         = false;
            _hasFont        = false;
            _hasTextPos     = true;
            _hasGraphicsPos = true;
        }
コード例 #3
0
        public bool equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            else if (!(o instanceof PDFFont))
            {
                return(false);
            }

            PDFFont font = (PDFFont)o;

            return(_face == font._face &&
                   _encoding.equals(font._encoding) &&
                   _opt.equals(font._opt));
        }
コード例 #4
0
        /**
         * Returns the value for a parameter.
         */
        public string get_parameter(String name, @Optional double modifier)
        {
            if ("fontname".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getFontName());
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        /**
         * Loads a font for later use.
         *
         * @param name the font name, e.g. Helvetica
         * @param encoding the font encoding, e.g. winansi
         * @param opt any options
         */
        public PDFFont load_font(String name, string encoding, string opt)

        {
            Font face = loadFont(name);

            PDFFont font = new PDFFont(face, encoding, opt);

            PDFFont oldFont = _fontMap.get(font);

            if (oldFont != null)
            {
                return(oldFont);
            }

            font.setId(_out.allocateId(1));

            _fontMap.put(font, font);

            _out.addPendingObject(font);

            return(font);
        }
コード例 #6
0
 public void setFont(PDFFont font, double size)
 {
     _font     = font;
     _fontSize = size;
     _hasFont  = false;
 }