1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-10-03 01:09:04 +00:00

Merge pull request #721 from matthew16550/font-test

Fix broken A000*_Test tests on macOS
This commit is contained in:
arnaudroques 2021-10-24 11:20:59 +02:00 committed by GitHub
commit f718c59a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ public class UFont {
public String toStringDebug() {
final StringBuilder sb = new StringBuilder();
sb.append(font.getFontName());
sb.append(getPortableFontName());
sb.append("/");
sb.append(font.getSize());
return sb.toString();
@ -168,6 +168,20 @@ public class UFont {
return family;
}
// Kludge for testing because font names on some machines (only macOS?) do not end with <DOT><STYLE>
// See https://github.com/plantuml/plantuml/issues/720
private String getPortableFontName() {
final String name = font.getFontName();
if (font.isBold() && font.isItalic())
return name.endsWith(".bolditalic") ? name : name + ".bolditalic";
else if (font.isBold())
return name.endsWith(".bold") ? name : name + ".bold";
else if (font.isItalic())
return name.endsWith(".italic") ? name : name + ".italic";
else
return name.endsWith(".plain") ? name : name + ".plain";
}
@Override
public String toString() {
return font.toString()/* + " " + font.getPSName() */;