mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use fallback font for Splash screen
This commit is contained in:
@@ -19,9 +19,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -176,6 +173,7 @@ public class Splash extends JDialog implements StartupProgress {
|
||||
font = createFont(UIUtil.ARIAL_FONT_NAME);
|
||||
}
|
||||
|
||||
g.setFont(UIUtil.getFontWithFallback(font));
|
||||
g.setColor(textColor);
|
||||
int offsetX = uiScale(15);
|
||||
int offsetY = 30;
|
||||
@@ -188,9 +186,9 @@ public class Splash extends JDialog implements StartupProgress {
|
||||
}
|
||||
}
|
||||
|
||||
g.drawString(wrapText(licensedToMessage, font), x + offsetX, y + height - uiScale(offsetY));
|
||||
g.drawString(licensedToMessage, x + offsetX, y + height - uiScale(offsetY));
|
||||
if (licenseRestrictionsMessages.size() > 0) {
|
||||
g.drawString(wrapText(licenseRestrictionsMessages.get(0), font), x + offsetX, y + height - uiScale(offsetY - 16));
|
||||
g.drawString(licenseRestrictionsMessages.get(0), x + offsetX, y + height - uiScale(offsetY - 16));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -198,29 +196,6 @@ public class Splash extends JDialog implements StartupProgress {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static AttributedCharacterIterator wrapText(String text, Font font) {
|
||||
Font fallbackFont = createFont("Serif");
|
||||
AttributedString result = new AttributedString(text);
|
||||
if (text.isEmpty()) return result.getIterator();
|
||||
|
||||
Font curFont = font.canDisplay(text.charAt(0)) ? font : fallbackFont;
|
||||
int start = 0, end = 0;
|
||||
|
||||
for (int i = 1; i < text.length(); i++) {
|
||||
Font f = font.canDisplay(text.charAt(i)) ? font : fallbackFont;
|
||||
if (f != curFont) {
|
||||
result.addAttribute(TextAttribute.FONT, curFont, start, end);
|
||||
start = i;
|
||||
end = start;
|
||||
curFont = f;
|
||||
} else {
|
||||
end++;
|
||||
}
|
||||
}
|
||||
result.addAttribute(TextAttribute.FONT, curFont, start, end);
|
||||
return result.getIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static Font createFont(String name) {
|
||||
return new Font(name, Font.PLAIN, uiScale(Registry.is("ide.new.about") ? 12 : SystemInfo.isUnix ? 10 : 11));
|
||||
|
||||
Reference in New Issue
Block a user