Skip to content

Commit

Permalink
IkonHandler impls should read their font resource instead
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Nov 9, 2020
1 parent 37f50ad commit 64fc42e
Show file tree
Hide file tree
Showing 107 changed files with 214 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ public class IkonResolver extends AbstractIkonResolver {
static {
INSTANCE = new IkonResolver();

ClassLoader classLoader = IkonResolver.class.getClassLoader();
ServiceLoader<IkonHandler> loader = ServiceLoader.load(IkonHandler.class, classLoader);
ServiceLoader<IkonHandler> loader = ServiceLoader.load(IkonHandler.class.getModule().getLayer(), IkonHandler.class);
for (IkonHandler handler : loader) {
HANDLERS.add(handler);
handler.setFont(Font.loadFont(classLoader.getResource(handler.getFontResourcePath()).toExternalForm(), 16));
handler.setFont(Font.loadFont(handler.getFontResourcePath(), 16));
}
}

Expand Down
3 changes: 2 additions & 1 deletion docs/guide/src/docs/asciidoc/authoring.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public class MyIconIkonHandler extends AbstractIkonHandler {
@Override
public String getFontResourcePath() {
return "META-INF/resources/myicon/1.2.3/fonts/myicon.ttf"; // <3>
return getClass().getResource("/META-INF/resources/myicon/1.2.3/fonts/myicon.ttf")
.toExternalFrom(); // <3>
}
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/antdesignicons/4.0.0/fonts/AntDesign-Icons-Filled.ttf";
return getClass().getResource("/META-INF/resources/antdesignicons/4.0.0/fonts/AntDesign-Icons-Filled.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/antdesignicons/4.0.0/fonts/AntDesign-Icons-Outlined.ttf";
return getClass().getResource("/META-INF/resources/antdesignicons/4.0.0/fonts/AntDesign-Icons-Outlined.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/boxicons/2.0.7/fonts/boxicons.ttf";
return getClass().getResource("/META-INF/resources/boxicons/2.0.7/fonts/boxicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public org.kordamp.ikonli.Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/boxicons/2.0.7/fonts/boxicons.ttf";
return getClass().getResource("/META-INF/resources/boxicons/2.0.7/fonts/boxicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public org.kordamp.ikonli.Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/boxicons/2.0.7/fonts/boxicons.ttf";
return getClass().getResource("/META-INF/resources/boxicons/2.0.7/fonts/boxicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/bpmn/0.10.0/fonts/bpmn.ttf";
return getClass().getResource("/META-INF/resources/bpmn/0.10.0/fonts/bpmn.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/captainicon/20140501/fonts/captainicon.ttf";
return getClass().getResource("/META-INF/resources/captainicon/20140501/fonts/captainicon.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public org.kordamp.ikonli.Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/carbonicons/10.23.2/fonts/Carbon-Icons.ttf";
return getClass().getResource("/META-INF/resources/carbonicons/10.23.2/fonts/Carbon-Icons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/codicons/0.0.12/fonts/codicon.ttf";
return getClass().getResource("/META-INF/resources/codicons/0.0.12/fonts/codicon.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/coreui/2.0.0-beta.5/fonts/CoreUI-Icons-Brand.ttf";
return getClass().getResource("/META-INF/resources/coreui/2.0.0-beta.5/fonts/CoreUI-Icons-Brand.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/coreui/2.0.0-beta.5/fonts/CoreUI-Icons-Free.ttf";
return getClass().getResource("/META-INF/resources/coreui/2.0.0-beta.5/fonts/CoreUI-Icons-Free.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/dashicons/20200504/fonts/dashicons.ttf";
return getClass().getResource("/META-INF/resources/dashicons/20200504/fonts/dashicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/devicons/1.8.0/fonts/devicons.ttf";
return getClass().getResource("/META-INF/resources/devicons/1.8.0/fonts/devicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/elusive/2.0/fonts/Elusive-Icons.ttf";
return getClass().getResource("/META-INF/resources/elusive/2.0/fonts/Elusive-Icons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/entypo/1.0/fonts/Entypo.ttf";
return getClass().getResource("/META-INF/resources/entypo/1.0/fonts/Entypo.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/evaicons/1.1.3/fonts/Evaicons.ttf";
return getClass().getResource("/META-INF/resources/evaicons/1.1.3/fonts/Evaicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/feather/4.28/fonts/feather.ttf";
return getClass().getResource("/META-INF/resources/feather/4.28/fonts/feather.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fileicons/2.1.44/fonts/File-Icons.ttf";
return getClass().getResource("/META-INF/resources/fileicons/2.1.44/fonts/File-Icons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Filled.ttf";
return getClass().getResource("/META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Filled.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Filled.ttf";
return getClass().getResource("/META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Filled.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Regular.ttf";
return getClass().getResource("/META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Regular.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Regular.ttf";
return getClass().getResource("/META-INF/resources/fluentui/1.1.74/fonts/FluentSystemIcons-Regular.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fontawesome/4.7.0/fonts/fontawesome-webfont.ttf";
return getClass().getResource("/META-INF/resources/fontawesome/4.7.0/fonts/fontawesome-webfont.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fontawesome5/5.15.1/fonts/fa-brands-400.ttf";
return getClass().getResource("/META-INF/resources/fontawesome5/5.15.1/fonts/fa-brands-400.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fontawesome5/5.15.1/fonts/fa-regular-400.ttf";
return getClass().getResource("/META-INF/resources/fontawesome5/5.15.1/fonts/fa-regular-400.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fontawesome5/5.15.1/fonts/fa-solid-900.ttf";
return getClass().getResource("/META-INF/resources/fontawesome5/5.15.1/fonts/fa-solid-900.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/fontelico/0.0/fonts/fontelico.ttf";
return getClass().getResource("/META-INF/resources/fontelico/0.0/fonts/fontelico.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/foundation/3.0/fonts/foundation-icons.ttf";
return getClass().getResource("/META-INF/resources/foundation/3.0/fonts/foundation-icons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/hawcons/20140708/fonts/hawconsfilled.ttf";
return getClass().getResource("/META-INF/resources/hawcons/20140708/fonts/hawconsfilled.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/hawcons/20140708/fonts/hawconsstroke.ttf";
return getClass().getResource("/META-INF/resources/hawcons/20140708/fonts/hawconsstroke.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/icomoon/0.0/fonts/icomoon.ttf";
return getClass().getResource("/META-INF/resources/icomoon/0.0/fonts/icomoon.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/ionicons/2.0.1/fonts/ionicons.ttf";
return getClass().getResource("/META-INF/resources/ionicons/2.0.1/fonts/ionicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/ionicons4/4.1.2/fonts/ionicons.ttf";
return getClass().getResource("/META-INF/resources/ionicons4/4.1.2/fonts/ionicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/ionicons4/4.1.2/fonts/ionicons.ttf";
return getClass().getResource("/META-INF/resources/ionicons4/4.1.2/fonts/ionicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/ionicons4/4.1.2/fonts/ionicons.ttf";
return getClass().getResource("/META-INF/resources/ionicons4/4.1.2/fonts/ionicons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/jam/3.0.0/fonts/Jam-Icons.ttf";
return getClass().getResource("/META-INF/resources/jam/3.0.0/fonts/Jam-Icons.ttf")
.toExternalForm();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public Ikon resolve(String description) {

@Override
public String getFontResourcePath() {
return "META-INF/resources/ligaturesymbols/2.11/fonts/LigatureSymbols-2.11.ttf";
return getClass().getResource("/META-INF/resources/ligaturesymbols/2.11/fonts/LigatureSymbols-2.11.ttf")
.toExternalForm();
}

@Override
Expand Down
Loading

0 comments on commit 64fc42e

Please sign in to comment.