Package org.axsl.font

Examples of org.axsl.font.Font


     * @param word The word whose width should be computed.
     * @return The width of the word, in millipoints.
     */
    public int getWordWidth(final CharSequence word) {
        final FontUse fontUse = getPrimaryFont();
        final Font font = fontUse.getFont();
        fontUse.registerCharsUsed(word);
        return font.width(word, traitFontSize(),
                traitGeneratedBy().traitLetterSpacingOpt(this),
                traitGeneratedBy().traitWordSpacingOpt(this), true);
    }
View Full Code Here


     * @param word The word whose width should be computed.
     * @return The width of the word, in millipoints.
     */
    public int getWordWidth(final CharSequence word) {
        final FontUse fontUse = getPrimaryFont();
        final Font font = fontUse.getFont();
        fontUse.registerCharsUsed(word);
        return font.width(word, traitFontSize(),
                traitGeneratedBy().traitLetterSpacingOpt(this),
                traitGeneratedBy().traitWordSpacingOpt(this), true);
    }
View Full Code Here

        block = (Block) node;
        fontFamilies = block.traitFontFamily(null);
        assertEquals(1, fontFamilies.length);
        assertEquals("Base14-Courier", fontFamilies[0]);

        final Font font = block.getPrimaryFont(null).getFont();
        assertEquals("Courier", font.getFontName());
    }
View Full Code Here

        assertEquals(8000, fontSize);

        node = flow.getChildAt(2);
        assertTrue(node instanceof Block);
        block = (Block) node;
        final Font font = node.getPrimaryFont(null).getFont();
        assertEquals("Courier", font.getFamilyName());
        assertEquals(426, font.getXHeight(1000));
        final int nominalFontSize = block.traitFontSize(null);
        /* The nominal font-size is 10 pts. */
        assertEquals(10000, nominalFontSize);
        /* The font-size-adjust is .6. */
        final double fontSizeAdjust = block.traitFontSizeAdjust(null);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public String toPDF() {
        final Font font = this.font.getFont().getFontUse().getFont();
        final FontPdf fontPDF = this.font.getFont();
        final StringBuilder p = new StringBuilder();
        p.append(this.pdfID() + EOL);
        p.append("<< /Type /FontDescriptor" + EOL);
        p.append("/FontName /" + this.font.getBaseFont());
        p.append(EOL + "/FontBBox ");
        p.append(new PDFRectangle(fontPDF.getFontBoundingBox()).toPDFString());
        p.append(EOL + "/Flags ");
        p.append(fontPDF.getFlags());
        p.append(EOL + "/CapHeight ");
        p.append(font.getCapHeight(WKConstants.MILLIPOINTS_PER_POINT));
        p.append(EOL + "/Ascent ");
        p.append(font.getAscender(WKConstants.MILLIPOINTS_PER_POINT));
        p.append(EOL + "/Descent ");
        p.append(font.getDescender(WKConstants.MILLIPOINTS_PER_POINT));
        p.append(EOL + "/ItalicAngle ");
        p.append(fontPDF.getItalicAngleFormatted());
        p.append(EOL + "/StemV ");
        p.append(font.getStemV());
        // optional fields
        if (this.stemH != 0) {
            p.append(EOL + "/StemH ");
            p.append(this.stemH);
        }
View Full Code Here

     */
    protected void renderGenericSpace(final TextArea area) throws GalleyVisitorException {
        final int startX = area.crOriginX();
        int startY;
        final int endX = area.crOriginX() + area.crIpd();
        final Font font = area.getPrimaryFont().getFont();
        if (area.traitUnderlineScore()) {
            startY = getUnderlineYPosition(area);
            drawLine(startX, startY, endX, startY,
                    font.underlineSize(area.traitFontSize()),
                    RuleStyle.SOLID, area.traitUnderlineScoreColor());
        }
        if (area.traitOverlineScore()) {
            startY = getOverlineYPosition(area);
            drawLine(startX, startY, endX, startY,
                    font.overlineSize(area.traitFontSize()),
                    RuleStyle.SOLID, area.traitOverlineScoreColor());
        }
        if (area.traitThroughScore()) {
            startY = getThroughYPosition(area);
            drawLine(startX, startY, endX, startY,
                    font.strikeoutSize(area.traitFontSize()),
                    RuleStyle.SOLID, area.traitThroughScoreColor());
        }
    }
View Full Code Here

     * Computes the Y position that should be used for the underline stroke.
     * @param area The area whose metrics should be used for the computation.
     * @return The Y position that should be used for the underline stroke.
     */
    protected int getUnderlineYPosition(final TextArea area) {
        final Font font = area.getPrimaryFont().getFont();
        final int underlinePosition = font.underlinePosition(
                area.traitFontSize());
        return area.baselineY() + underlinePosition;
    }
View Full Code Here

     * Computes the Y position that should be used for the overline stroke.
     * @param area The area whose metrics should be used for the computation.
     * @return The Y position that should be used for the overline stroke.
     */
    protected int getOverlineYPosition(final TextArea area) {
        final Font font = area.getPrimaryFont().getFont();
        final int overlinePosition = font.overlinePosition(
                area.traitFontSize());
        return area.baselineY() + overlinePosition;
    }
View Full Code Here

     * Computes the Y position that should be used for the through stroke.
     * @param area The area whose metrics should be used for the computation.
     * @return The Y position that should be used for the through stroke.
     */
    protected int getThroughYPosition(final TextArea area) {
        final Font font = area.getPrimaryFont().getFont();
        final int strikeoutPosition = font.strikeoutPosition(
                area.traitFontSize());
        return area.baselineY() + strikeoutPosition;
    }
View Full Code Here

    public Baseline getBaselineFromScript(final FoContext context) {
        final FontUse fontUse = this.getPrimaryFont(context);
        if (fontUse == null) {
            throw new IllegalStateException("Unable to obtain a font for baseline computation.");
        }
        final Font font = fontUse.getFont();
        final Script script = this.traitScript(context);
        final String opentypeScript = FontUtil.getOpenTypeScript(script);
        final Font.Baseline fontBaseline = font.baseline(opentypeScript);
        switch (fontBaseline) {
        case ALPHABETIC: return Baseline.ALPHABETIC;
        case MATH: return Baseline.MATHEMATICAL;
        case HANGING: return Baseline.HANGING;
        case IDEO_BOTTOM_LEFT: return Baseline.TEXT_AFTER_EDGE;
View Full Code Here

TOP

Related Classes of org.axsl.font.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.