Java Code Examples for java.awt.font.FontRenderContext#getAntiAliasingHint()

The following examples show how to use java.awt.font.FontRenderContext#getAntiAliasingHint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Font.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 2
Source File: Font.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 3
Source File: Font.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 4
Source File: Font.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 5
Source File: Font.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 6
Source File: Font.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 7
Source File: Font.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 8
Source File: EditorView.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean setFontRenderContext(FontRenderContext context) {
  FontRenderContext contextToSet = context == null ? FontInfo.getFontRenderContext(myEditor.getContentComponent()) : context;
  if (areEqualContexts(myFontRenderContext, contextToSet)) return false;
  myFontRenderContext = contextToSet.getFractionalMetricsHint() == myEditor.myFractionalMetricsHintValue
                        ? contextToSet
                        : new FontRenderContext(contextToSet.getTransform(), contextToSet.getAntiAliasingHint(), myEditor.myFractionalMetricsHintValue);
  return true;
}
 
Example 9
Source File: Font.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 10
Source File: Font.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 11
Source File: Font.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 12
Source File: Font.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 13
Source File: Font.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 14
Source File: Font.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 15
Source File: Font.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private float getItalicAngle(FontRenderContext frc) {
    Object aa, fm;
    if (frc == null) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
        fm = RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
    } else {
        aa = frc.getAntiAliasingHint();
        fm = frc.getFractionalMetricsHint();
    }
    return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
 
Example 16
Source File: FontStrikeDesc.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static int getAAHintIntVal(Font2D font2D, Font font,
                                  FontRenderContext frc) {
    Object aa = frc.getAntiAliasingHint();
    if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
        aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
        return INTVAL_TEXT_ANTIALIAS_ON;
    } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
        /* FRC.isIdentity() would have been useful */
        int ptSize;
        AffineTransform tx = frc.getTransform();
        if (tx.isIdentity() && !font.isTransformed()) {
            ptSize = font.getSize();
        } else {
            /* one or both transforms is not identity */
            float size = font.getSize2D();
            if (tx.isIdentity()) {
                tx = font.getTransform();
                tx.scale(size, size);
            } else {
                tx.scale(size, size);
                if (font.isTransformed()) {
                    tx.concatenate(font.getTransform());
                }
            }
            double shearx = tx.getShearX();
            double scaley = tx.getScaleY();
            if (shearx != 0) {
                scaley = Math.sqrt(shearx * shearx + scaley * scaley);
            }
            ptSize = (int)(Math.abs(scaley)+0.5);
        }
        if (font2D.useAAForPtSize(ptSize)) {
            return INTVAL_TEXT_ANTIALIAS_ON;
        } else {
            return INTVAL_TEXT_ANTIALIAS_OFF;
        }
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
    } else {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    }
}
 
Example 17
Source File: FontStrikeDesc.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static int getAAHintIntVal(Font2D font2D, Font font,
                                  FontRenderContext frc) {
    Object aa = frc.getAntiAliasingHint();
    if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
        aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
        return INTVAL_TEXT_ANTIALIAS_ON;
    } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
        /* FRC.isIdentity() would have been useful */
        int ptSize;
        AffineTransform tx = frc.getTransform();
        if (tx.isIdentity() && !font.isTransformed()) {
            ptSize = font.getSize();
        } else {
            /* one or both transforms is not identity */
            float size = font.getSize2D();
            if (tx.isIdentity()) {
                tx = font.getTransform();
                tx.scale(size, size);
            } else {
                tx.scale(size, size);
                if (font.isTransformed()) {
                    tx.concatenate(font.getTransform());
                }
            }
            double shearx = tx.getShearX();
            double scaley = tx.getScaleY();
            if (shearx != 0) {
                scaley = Math.sqrt(shearx * shearx + scaley * scaley);
            }
            ptSize = (int)(Math.abs(scaley)+0.5);
        }
        if (font2D.useAAForPtSize(ptSize)) {
            return INTVAL_TEXT_ANTIALIAS_ON;
        } else {
            return INTVAL_TEXT_ANTIALIAS_OFF;
        }
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
    } else {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    }
}
 
Example 18
Source File: FontStrikeDesc.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static int getAAHintIntVal(Font2D font2D, Font font,
                                  FontRenderContext frc) {
    Object aa = frc.getAntiAliasingHint();
    if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
        aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
        return INTVAL_TEXT_ANTIALIAS_ON;
    } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
        /* FRC.isIdentity() would have been useful */
        int ptSize;
        AffineTransform tx = frc.getTransform();
        if (tx.isIdentity() && !font.isTransformed()) {
            ptSize = font.getSize();
        } else {
            /* one or both transforms is not identity */
            float size = font.getSize2D();
            if (tx.isIdentity()) {
                tx = font.getTransform();
                tx.scale(size, size);
            } else {
                tx.scale(size, size);
                if (font.isTransformed()) {
                    tx.concatenate(font.getTransform());
                }
            }
            double shearx = tx.getShearX();
            double scaley = tx.getScaleY();
            if (shearx != 0) {
                scaley = Math.sqrt(shearx * shearx + scaley * scaley);
            }
            ptSize = (int)(Math.abs(scaley)+0.5);
        }
        if (font2D.useAAForPtSize(ptSize)) {
            return INTVAL_TEXT_ANTIALIAS_ON;
        } else {
            return INTVAL_TEXT_ANTIALIAS_OFF;
        }
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
    } else {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    }
}
 
Example 19
Source File: FontStrikeDesc.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static int getAAHintIntVal(Font2D font2D, Font font,
                                  FontRenderContext frc) {
    Object aa = frc.getAntiAliasingHint();
    if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
        aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
        return INTVAL_TEXT_ANTIALIAS_ON;
    } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
        /* FRC.isIdentity() would have been useful */
        int ptSize;
        AffineTransform tx = frc.getTransform();
        if (tx.isIdentity() && !font.isTransformed()) {
            ptSize = font.getSize();
        } else {
            /* one or both transforms is not identity */
            float size = font.getSize2D();
            if (tx.isIdentity()) {
                tx = font.getTransform();
                tx.scale(size, size);
            } else {
                tx.scale(size, size);
                if (font.isTransformed()) {
                    tx.concatenate(font.getTransform());
                }
            }
            double shearx = tx.getShearX();
            double scaley = tx.getScaleY();
            if (shearx != 0) {
                scaley = Math.sqrt(shearx * shearx + scaley * scaley);
            }
            ptSize = (int)(Math.abs(scaley)+0.5);
        }
        if (font2D.useAAForPtSize(ptSize)) {
            return INTVAL_TEXT_ANTIALIAS_ON;
        } else {
            return INTVAL_TEXT_ANTIALIAS_OFF;
        }
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
    } else {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    }
}
 
Example 20
Source File: FontStrikeDesc.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static int getAAHintIntVal(Font2D font2D, Font font,
                                  FontRenderContext frc) {
    Object aa = frc.getAntiAliasingHint();
    if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
        aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
        return INTVAL_TEXT_ANTIALIAS_ON;
    } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
        /* FRC.isIdentity() would have been useful */
        int ptSize;
        AffineTransform tx = frc.getTransform();
        if (tx.isIdentity() && !font.isTransformed()) {
            ptSize = font.getSize();
        } else {
            /* one or both transforms is not identity */
            float size = font.getSize2D();
            if (tx.isIdentity()) {
                tx = font.getTransform();
                tx.scale(size, size);
            } else {
                tx.scale(size, size);
                if (font.isTransformed()) {
                    tx.concatenate(font.getTransform());
                }
            }
            double shearx = tx.getShearX();
            double scaley = tx.getScaleY();
            if (shearx != 0) {
                scaley = Math.sqrt(shearx * shearx + scaley * scaley);
            }
            ptSize = (int)(Math.abs(scaley)+0.5);
        }
        if (font2D.useAAForPtSize(ptSize)) {
            return INTVAL_TEXT_ANTIALIAS_ON;
        } else {
            return INTVAL_TEXT_ANTIALIAS_OFF;
        }
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
    } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
               aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
        return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
    } else {
        return INTVAL_TEXT_ANTIALIAS_OFF;
    }
}