|
|
|
@ -8,6 +8,7 @@ import com.fr.design.ExtraDesignClassManager;
|
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
import com.fr.design.fun.DesignerEnvProcessor; |
|
|
|
|
import com.fr.design.gui.UILookAndFeel; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.exit.DesignerExiter; |
|
|
|
|
import com.fr.file.FileFILE; |
|
|
|
@ -21,7 +22,9 @@ import com.fr.stable.StableUtils;
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.os.OperatingSystem; |
|
|
|
|
import com.fr.start.ServerStarter; |
|
|
|
|
import com.fr.value.NotNullLazyValue; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import javax.swing.UIManager; |
|
|
|
@ -248,6 +251,7 @@ public class DesignUtils {
|
|
|
|
|
// 刷新DesignerFrame里面的面板
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
if (DesignerContext.getDesignerFrame() == null) { |
|
|
|
|
return; |
|
|
|
@ -269,7 +273,7 @@ public class DesignUtils {
|
|
|
|
|
FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); |
|
|
|
|
} |
|
|
|
|
//获取当前系统语言下设计器用的默认字体
|
|
|
|
|
FRFont guiFRFont = getCurrentLocaleFont(); |
|
|
|
|
FRFont guiFRFont = getDefaultGUIFont(); |
|
|
|
|
//指定UIManager中字体
|
|
|
|
|
Enumeration keys = UIManager.getDefaults().keys(); |
|
|
|
|
while (keys.hasMoreElements()) { |
|
|
|
@ -286,41 +290,50 @@ public class DesignUtils {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当前系统语言下设计器用的默认字体 |
|
|
|
|
* 获取当前系统语言下设计器界面使用的默认字体 |
|
|
|
|
* |
|
|
|
|
* @return 默认字体 |
|
|
|
|
*/ |
|
|
|
|
private static FRFont getCurrentLocaleFont() { |
|
|
|
|
FRFont guiFRFont; |
|
|
|
|
Locale defaultLocale = Locale.getDefault(); |
|
|
|
|
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
|
|
|
|
|
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) { |
|
|
|
|
guiFRFont = getNamedFont("Microsoft YaHei"); |
|
|
|
|
} else if (isDisplaySimSun(defaultLocale)) { |
|
|
|
|
guiFRFont = getNamedFont("SimSun"); |
|
|
|
|
} else { |
|
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
|
} |
|
|
|
|
public static FRFont getDefaultGUIFont() { |
|
|
|
|
return CURRENT_LOCALE_FONT.getValue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整.
|
|
|
|
|
Locale designerLocale = GeneralContext.getLocale(); |
|
|
|
|
String file = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"); |
|
|
|
|
char displayChar = file.charAt(0); |
|
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
|
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
|
|
|
|
|
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
|
|
|
|
|
guiFRFont = getNamedFont("SimSun"); |
|
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
|
//比如想在中文或英文系统里用韩文设计器
|
|
|
|
|
/** |
|
|
|
|
* 获取当前系统语言下设计器用的默认字体 |
|
|
|
|
*/ |
|
|
|
|
private static final NotNullLazyValue<FRFont> CURRENT_LOCALE_FONT = new NotNullLazyValue<FRFont>() { |
|
|
|
|
@NotNull |
|
|
|
|
@Override |
|
|
|
|
protected FRFont compute() { |
|
|
|
|
FRFont guiFRFont; |
|
|
|
|
Locale defaultLocale = Locale.getDefault(); |
|
|
|
|
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
|
|
|
|
|
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) { |
|
|
|
|
guiFRFont = getNamedFont("Microsoft YaHei"); |
|
|
|
|
} else if (isDisplaySimSun(defaultLocale)) { |
|
|
|
|
guiFRFont = getNamedFont("SimSun"); |
|
|
|
|
} else { |
|
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String file = Toolkit.i18nText("Fine-Design_Basic_File"); |
|
|
|
|
char displayChar = file.charAt(0); |
|
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
|
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
|
|
|
|
|
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
|
|
|
|
|
guiFRFont = getNamedFont("SimSun"); |
|
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
|
FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); |
|
|
|
|
//比如想在中文或英文系统里用韩文设计器
|
|
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
|
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return guiFRFont; |
|
|
|
|
} |
|
|
|
|
return guiFRFont; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private static FRFont getNamedFont(String name) { |
|
|
|
|
return FRFont.getInstance(name, Font.PLAIN, 12); |
|
|
|
|