Java Code Examples for java.awt.RenderingHints#VALUE_TEXT_ANTIALIAS_OFF

The following examples show how to use java.awt.RenderingHints#VALUE_TEXT_ANTIALIAS_OFF . 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 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 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 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 9
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 10
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 11
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 12
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 13
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 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: FlatLaf.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
private void putAATextInfo( UIDefaults defaults ) {
	if( SystemInfo.IS_JAVA_9_OR_LATER ) {
		Object desktopHints = Toolkit.getDefaultToolkit().getDesktopProperty( DESKTOPFONTHINTS );
		if( desktopHints instanceof Map ) {
			@SuppressWarnings( "unchecked" )
			Map<Object, Object> hints = (Map<Object, Object>) desktopHints;
			Object aaHint = hints.get( RenderingHints.KEY_TEXT_ANTIALIASING );
			if( aaHint != null &&
				aaHint != RenderingHints.VALUE_TEXT_ANTIALIAS_OFF &&
				aaHint != RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT )
			{
				defaults.put( RenderingHints.KEY_TEXT_ANTIALIASING, aaHint );
				defaults.put( RenderingHints.KEY_TEXT_LCD_CONTRAST,
					hints.get( RenderingHints.KEY_TEXT_LCD_CONTRAST ) );
			}
		}
	} else {
		// Java 8
		try {
			Object key = Class.forName( "sun.swing.SwingUtilities2" )
				.getField( "AA_TEXT_PROPERTY_KEY" )
				.get( null );
			Object value = Class.forName( "sun.swing.SwingUtilities2$AATextInfo" )
				.getMethod( "getAATextInfo", boolean.class )
				.invoke( null, true );
			defaults.put( key, value );
		} catch( Exception ex ) {
			Logger.getLogger( FlatLaf.class.getName() ).log( Level.SEVERE, null, ex );
			throw new RuntimeException( ex );
		}
	}
}
 
Example 16
Source File: EditorRenderingHints.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static boolean isAAOnByDefault() {
    Map systemHints = (Map) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"); //NOI18N
    if (systemHints != null) {
        Object o = systemHints.get(RenderingHints.KEY_TEXT_ANTIALIASING);
        boolean result = o != null && 
                         o != RenderingHints.VALUE_TEXT_ANTIALIAS_OFF &&  
                         o != RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT;
        return result;
    } else {
        return false;
    }
}
 
Example 17
Source File: AWTTerminalFontConfiguration.java    From lanterna with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static boolean isFontMonospaced(Font font) {
    if(MONOSPACE_CHECK_OVERRIDE.contains(font.getName())) {
        return true;
    }
    FontRenderContext frc = new FontRenderContext(
            null,
            RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
            RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT);
    Rectangle2D iBounds = font.getStringBounds("i", frc);
    Rectangle2D mBounds = font.getStringBounds("W", frc);
    return iBounds.getWidth() == mBounds.getWidth();
}
 
Example 18
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);
}