Java Code Examples for java.awt.RenderingHints#VALUE_TEXT_ANTIALIAS_ON

The following examples show how to use java.awt.RenderingHints#VALUE_TEXT_ANTIALIAS_ON . 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: TestTransform.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 2
Source File: FontTask.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addToResources(EditableResources e) {
    if(logicalName == null) {
        logicalName = "Arial" + getIdentity() + size;
        createBitmap = false;
    } else {
        if(logicalName.indexOf('-') < 0) {
            logicalName += getIdentity() + size;
        }
    }
    Object aa;
    if(antiAliasing) {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
    } else {
        aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
    }
    EditorFont f = new EditorFont(Font.createSystemFont(systemFace, systemStyle, systemSize),
            null, logicalName, createBitmap, aa, charset);
    e.setFont(getName(), f);
}
 
Example 3
Source File: TestTransform.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 4
Source File: TestTransform.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 5
Source File: TestTransform.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 6
Source File: TestTransform.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 7
Source File: TestTransform.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 8
Source File: TestTransform.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 9
Source File: TestTransform.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 10
Source File: TestTransform.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 11
Source File: TestTransform.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 12
Source File: TestTransform.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 13
Source File: TestTransform.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 14
Source File: TestTransform.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
    int i, j, k;
    AffineTransform a = new AffineTransform();

    for (i=0; i<aahints.length; i++) {
        for(j=0; j<8; j++) {
            System.out.println("Testing hint "+i+" angle="+j);
            a.setToRotation(j*Math.PI/4);
            testTransformedFont(a, aahints[i]);
        }
        testFontOfSize(0.0f, aahints[i]);
        testFontOfSize(-10.0f, aahints[i]);
    }
}
 
Example 15
Source File: AWTTerminalFontConfiguration.java    From lanterna with GNU Lesser General Public License v3.0 5 votes vote down vote up
private FontRenderContext getFontRenderContext() {
    return new FontRenderContext(
            null,
            useAntiAliasing ?
                    RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT);
}
 
Example 16
Source File: SwingDirectGC.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void setAntialias( boolean antiAlias ) {
  if ( antiAlias ) {

    RenderingHints hints =
      new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
    hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY ) );
    hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ) );
    // hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
    // RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
    gc.setRenderingHints( hints );
  }
}
 
Example 17
Source File: SwingGC.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void setAntialias( boolean antiAlias ) {
  if ( antiAlias ) {

    RenderingHints hints =
      new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
    hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY ) );
    hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ) );
    // hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
    // RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
    gc.setRenderingHints( hints );
  }
}