Package java.awt.font

Examples of java.awt.font.FontRenderContext


  {
    final boolean antialias = RenderingHints.VALUE_TEXT_ANTIALIAS_ON.equals(getRenderingHint(
        RenderingHints.KEY_TEXT_ANTIALIASING));
    final boolean fractions = RenderingHints.VALUE_FRACTIONALMETRICS_ON.equals(getRenderingHint(
        RenderingHints.KEY_FRACTIONALMETRICS));
    return new FontRenderContext(new AffineTransform(), antialias, fractions);
  }
View Full Code Here


    long minimumChunkWidth = 0;
    BreakIterator wordInstance = BreakIterator.getWordInstance();
    wordInstance.setText(text);

    final boolean antiAliasing = RenderUtility.isFontSmooth(getStyleSheet(), data);
    final FontRenderContext fontRenderContext = new FontRenderContext(null, antiAliasing, true);

    int start = wordInstance.first();
    for (int end = wordInstance.next(); end != BreakIterator.DONE; start = end, end = wordInstance.next())
    {
      String word = text.substring(start, end);
View Full Code Here

      g2.setFont(new Font(fontName, style, fontSize));
    }

    final Font f = g2.getFont();
    final FontMetrics fm = g2.getFontMetrics(f);
    final FontRenderContext frc = g2.getFontRenderContext();
    final double y = area.getCenterY();

    final int highest = getHighest();
    for (int i = getLowest(); i <= highest; i++)
    {
View Full Code Here

  protected final Font font;

  public SystemFontMetrics(String fontName) {
    BufferedImage img = new BufferedImage(40, 40, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D graphics = GraphicsEnvironment.getLocalGraphicsEnvironment().createGraphics(img);
    FontRenderContext fontRenderContext = graphics.getFontRenderContext();
    this.font = new Font(fontName, Font.PLAIN, 1000);
    double maxHeight = 0;
    for (int i = 0; i < 255; i++) {
      TextLayout layout = new TextLayout(Character.toString((char)i), font, fontRenderContext);
      maxHeight = Math.max(maxHeight, layout.getBounds().getHeight());
View Full Code Here

        Label label = (Label)getComponent();
        String text = label.getText();

        int preferredWidth = 0;
        if (text != null && text.length() > 0) {
            FontRenderContext fontRenderContext = Platform.getFontRenderContext();
            String str[];
            if (wrapText) {
                str = text.split("\n");
            } else {
                str = new String[] { text };
View Full Code Here

        String text = label.getText();

        float preferredHeight;
        if (text != null) {
            int widthUpdated = width;
            FontRenderContext fontRenderContext = Platform.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("", fontRenderContext);
            float lineHeight = lm.getHeight();

            preferredHeight = lineHeight;
View Full Code Here

    @Override
    public Dimensions getPreferredSize() {
        Label label = (Label)getComponent();
        String text = label.getText();

        FontRenderContext fontRenderContext = Platform.getFontRenderContext();

        LineMetrics lm = font.getLineMetrics("", fontRenderContext);
        int lineHeight = (int)Math.ceil(lm.getHeight());

        int preferredHeight = 0;
View Full Code Here

        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public int getBaseline(int width, int height) {
        FontRenderContext fontRenderContext = Platform.getFontRenderContext();
        LineMetrics lm = font.getLineMetrics("", fontRenderContext);
        float ascent = lm.getAscent();

        float textHeightLocal;
        if (wrapText) {
View Full Code Here

        if (text != null) {
            int n = text.length();

            if (n > 0) {
                FontRenderContext fontRenderContext = Platform.getFontRenderContext();

                if (wrapText) {
                    int width = getWidth() - (padding.left + padding.right);

                    int i = 0;
View Full Code Here

                graphics.setPaint(color);
            } else {
                graphics.setPaint(disabledColor);
            }

            FontRenderContext fontRenderContext = Platform.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("", fontRenderContext);
            float ascent = lm.getAscent();
            float lineHeight = lm.getHeight();

            float y = 0;
View Full Code Here

TOP

Related Classes of java.awt.font.FontRenderContext

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.