From 8007355ad9444fa397f4a221f705728f99a654c1 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Fri, 19 Jan 2024 00:46:46 +0100 Subject: [PATCH] =?UTF-8?q?dev=20name=20and=20script=F0=9F=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/unicode/jsp/UnicodeUtilities.java | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java b/UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java index d4d86edbc..99699904f 100644 --- a/UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java +++ b/UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java @@ -1355,23 +1355,42 @@ public static void getDifferences( // ((RuleBasedCollator) col).setNumericCollation(true); // } + private static String getScriptCat(String versionPrefix, int cp) { + String scriptCat = getFactory().getProperty(versionPrefix + "script").getValue(cp).replace("_", " "); + if (scriptCat.equals("Common") || scriptCat.equals("Inherited")) { + scriptCat = getFactory().getProperty(versionPrefix + "gc").getValue(cp).replace("_", " "); + } else { + scriptCat += " Script"; + } + return scriptCat; + } + public static void showProperties( int cp, String history, boolean showDevProperties, Appendable out) throws IOException { String text = UTF16.valueOf(cp); String name = getFactory().getProperty("Name").getValue(cp); - if (name != null) { - name = toHTML.transliterate(name); + final String devName = + showDevProperties ? getFactory().getProperty("Udev:Name").getValue(cp) : null; + if (name == null) { + if (devName != null) { + name = "" + toHTML.transliterate(devName) + ""; + } else { + name = "Unknown"; + } } else { - name = "Unknown"; + name = toHTML.transliterate(name); } boolean allowed = XIDModifications.isAllowed(cp); - String scriptCat = getFactory().getProperty("script").getValue(cp).replace("_", " "); - if (scriptCat.equals("Common") || scriptCat.equals("Inherited")) { - scriptCat = getFactory().getProperty("gc").getValue(cp).replace("_", " "); - } else { - scriptCat += " Script"; + String scriptCat = getScriptCat("", cp); + if (showDevProperties) { + String devScriptCat = getScriptCat("Udev:", cp); + if (!devScriptCat.equals(scriptCat)) { + // The old and new script and GC will be given below; only show the new one here, + // but highlighted. + scriptCat = "" + devScriptCat + ""; + } } String hex = com.ibm.icu.impl.Utility.hex(cp, 4);