示例#1
0
        public void compose(TypeMetrics metrics)
        {
            if(metrics.getWidth() > getWidth()){
                this.setAscent( metrics.getAscent() );
                this.setDescent( metrics.getDescent() );
                this.setMaxAdvance( metrics.getMaxAdvance() );
                this.setWidth( metrics.getWidth() );
            }

            this.setHeight( this.getHeight() + metrics.getHeight() );
        }
示例#2
0
        public static TypeMetrics fromFontMetrics(FontMetrics fontMetrics, string str)
        {
            TypeMetrics metrics = new TypeMetrics();

            metrics.setAscent(fontMetrics.getAscent());
            metrics.setDescent(fontMetrics.getDescent());
            metrics.setHeight(fontMetrics.getHeight());
            metrics.setMaxAdvance(fontMetrics.getMaxAdvance());
            metrics.setWidth(fontMetrics.stringWidth(str));

            return metrics;
        }