diff --git a/doc-img/shield_map_world.svg b/doc-img/shield_map_world.svg index 08c8d842a..31d484c20 100644 --- a/doc-img/shield_map_world.svg +++ b/doc-img/shield_map_world.svg @@ -140,6 +140,7 @@ See the end of this file for a list of available jurisdictions and their codes. .np, .ph, .pk, +.sa, .tr, .tw, .vn, diff --git a/icons/shield_sa_national.svg b/icons/shield_sa_national.svg new file mode 100644 index 000000000..896d6ec95 --- /dev/null +++ b/icons/shield_sa_national.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shieldlib/src/shield.ts b/shieldlib/src/shield.ts index 8eada1a6a..b96749a57 100644 --- a/shieldlib/src/shield.ts +++ b/shieldlib/src/shield.ts @@ -281,6 +281,9 @@ function getShieldDef( return shieldDef; } +export const arabizeRef = (ref) => + ref.replaceAll(/[0-9]/g, (m) => String.fromCharCode(0x0660 + parseInt(m))); + /** * Reformats an alphanumeric ref as Roman numerals, preserving any alphabetic * suffix. @@ -389,8 +392,15 @@ export function generateShieldCtx( // Convert numbering systems. Normally alternative numbering systems should be // tagged directly in ref=*, but some shields use different numbering systems // for aesthetic reasons only. - if (routeDef.ref && shieldDef.numberingSystem === "roman") { - routeDef.ref = romanizeRef(routeDef.ref); + if (routeDef.ref) { + switch (shieldDef.numberingSystem) { + case "arab": + routeDef.ref = arabizeRef(routeDef.ref); + break; + case "roman": + routeDef.ref = romanizeRef(routeDef.ref); + break; + } } // Add the halo around modifier plaque text diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index f39219f0f..e4e027d7b 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -3458,6 +3458,20 @@ export function loadShields() { }, }; + // Saudi Arabia + shields["SA:national"] = { + spriteBlank: "shield_sa_national", + textLayout: textConstraint("diamond"), + textColor: Color.shields.black, + numberingSystem: "arab", + padding: { + left: 3, + right: 2, + top: 4, + bottom: 3, + }, + }; + // Turkey shields["TR:motorway"] = hexagonVerticalShield( 2, diff --git a/src/shieldtest.js b/src/shieldtest.js index 26b052058..839ae9e42 100644 --- a/src/shieldtest.js +++ b/src/shieldtest.js @@ -239,6 +239,10 @@ let networks = [ "AU:QLD:ALT", "AU:QLD:ALT_S", "AU:VIC:ALT_NR", + + // With other numeral systems + "IN:NE", + "SA:national", ]; // Uncomment for a list of all supported networks. This makes for a very long page.