Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/awt/FontClass/FontSize1Test.java
41149 views
1
/*
2
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 8216965
27
* @summary verify no crash when rendering size 1 fonts
28
*/
29
30
import java.awt.Font;
31
import java.awt.Graphics2D;
32
import java.awt.GraphicsEnvironment;
33
import java.awt.image.BufferedImage;
34
35
public class FontSize1Test {
36
37
static final String text = "abcdefghijklmnopqrstuvwxyz";
38
39
public static void main(String[] args) {
40
41
BufferedImage bi =
42
new BufferedImage(100, 20, BufferedImage.TYPE_INT_RGB);
43
Graphics2D g2d = bi.createGraphics();
44
Font af[] =
45
GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
46
47
for (Font f : af) {
48
System.out.println("Looking at font " + f);
49
g2d.setFont(f);
50
g2d.getFontMetrics().getWidths();
51
g2d.drawString(text, 50, 10);
52
}
53
g2d.dispose();
54
}
55
56
}
57
58