1 | package g0803.bindingofshiba.bundles; | |
2 | ||
3 | import java.awt.*; | |
4 | import java.io.IOException; | |
5 | import java.io.InputStream; | |
6 | import java.net.URL; | |
7 | ||
8 | public class DefaultFontsProvider implements BundleProvider<Font> { | |
9 | ||
10 | private final Bundle<Font> bundle = new HashMapBundle<>(); | |
11 | ||
12 | public DefaultFontsProvider() throws IOException, FontFormatException { | |
13 |
1
1. <init> : removed call to g0803/bindingofshiba/bundles/DefaultFontsProvider::loadFonts → KILLED |
this.loadFonts(); |
14 | } | |
15 | ||
16 | @Override | |
17 | public Bundle<Font> getBundle() { | |
18 |
1
1. getBundle : replaced return value with null for g0803/bindingofshiba/bundles/DefaultFontsProvider::getBundle → KILLED |
return bundle; |
19 | } | |
20 | ||
21 | private void loadFonts() throws IOException, FontFormatException { | |
22 | Font squareFont = loadFont("/fonts/square.ttf", 10); | |
23 | Font textFont = loadFont("/fonts/cg-pixel-4x5.ttf", 5); | |
24 | ||
25 |
1
1. loadFonts : removed call to g0803/bindingofshiba/bundles/Bundle::register → KILLED |
bundle.register("square", squareFont); |
26 |
1
1. loadFonts : removed call to g0803/bindingofshiba/bundles/Bundle::register → KILLED |
bundle.register("text", textFont); |
27 | } | |
28 | ||
29 | private Font loadFont(String location, int size) throws IOException, FontFormatException { | |
30 | URL resource = DefaultFontsProvider.class.getResource(location); | |
31 |
1
1. loadFont : negated conditional → SURVIVED |
if (resource == null) throw new IOException("Could not find resource at " + location); |
32 | ||
33 | InputStream fileStream = resource.openStream(); | |
34 | Font font = Font.createFont(Font.TRUETYPE_FONT, fileStream); | |
35 | ||
36 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); | |
37 | ge.registerFont(font); | |
38 | ||
39 |
1
1. loadFont : replaced return value with null for g0803/bindingofshiba/bundles/DefaultFontsProvider::loadFont → KILLED |
return font.deriveFont(Font.PLAIN, size); |
40 | } | |
41 | } | |
Mutations | ||
13 |
1.1 |
|
18 |
1.1 |
|
25 |
1.1 |
|
26 |
1.1 |
|
31 |
1.1 |
|
39 |
1.1 |