From 3577712151a27bc70e57f65dcc33a1c115e88e49 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 8 Oct 2023 14:26:59 -0400 Subject: [PATCH 1/3] change shield font to Noto Sans Condensed --- icons/shield_ca_mb_winnipeg.svg | 4 - icons/shield_ca_ns_h.svg | 8 -- icons/shield_ca_on_primary.svg | 3 +- icons/shield_ca_tch.svg | 3 - icons/shield_ca_tch_2.svg | 3 + icons/shield_ca_tch_3.svg | 3 + icons/shield_in_nh_2.svg | 2 +- icons/shield_in_nh_3.svg | 4 +- icons/shield_in_nh_4.svg | 4 +- icons/shield_kr_expressway_2.svg | 6 +- icons/shield_kr_expressway_3.svg | 6 +- icons/shield_us_fl_toll.svg | 8 +- icons/shield_us_ut_2.svg | 4 +- icons/shield_us_ut_3.svg | 4 +- scripts/build.ts | 10 +- shieldlib/src/screen_gfx.ts | 2 +- shieldlib/src/shield_helper.ts | 10 +- src/fonts.css | 18 +++ src/index.html | 11 ++ src/js/shield_defs.js | 193 ++++++++++++++++--------------- src/shieldtest.html | 17 ++- src/shieldtest.js | 5 +- 22 files changed, 176 insertions(+), 152 deletions(-) delete mode 100644 icons/shield_ca_mb_winnipeg.svg delete mode 100644 icons/shield_ca_ns_h.svg delete mode 100644 icons/shield_ca_tch.svg create mode 100644 icons/shield_ca_tch_2.svg create mode 100644 icons/shield_ca_tch_3.svg create mode 100644 src/fonts.css diff --git a/icons/shield_ca_mb_winnipeg.svg b/icons/shield_ca_mb_winnipeg.svg deleted file mode 100644 index 913652204..000000000 --- a/icons/shield_ca_mb_winnipeg.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/icons/shield_ca_ns_h.svg b/icons/shield_ca_ns_h.svg deleted file mode 100644 index 636f74df6..000000000 --- a/icons/shield_ca_ns_h.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/icons/shield_ca_on_primary.svg b/icons/shield_ca_on_primary.svg index 71a72ce15..b6b25e117 100644 --- a/icons/shield_ca_on_primary.svg +++ b/icons/shield_ca_on_primary.svg @@ -1,4 +1,3 @@ - - + diff --git a/icons/shield_ca_tch.svg b/icons/shield_ca_tch.svg deleted file mode 100644 index 1aa807c16..000000000 --- a/icons/shield_ca_tch.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/icons/shield_ca_tch_2.svg b/icons/shield_ca_tch_2.svg new file mode 100644 index 000000000..063fe7777 --- /dev/null +++ b/icons/shield_ca_tch_2.svg @@ -0,0 +1,3 @@ + + + diff --git a/icons/shield_ca_tch_3.svg b/icons/shield_ca_tch_3.svg new file mode 100644 index 000000000..2deb71227 --- /dev/null +++ b/icons/shield_ca_tch_3.svg @@ -0,0 +1,3 @@ + + + diff --git a/icons/shield_in_nh_2.svg b/icons/shield_in_nh_2.svg index 1e9651039..8739bd0cb 100644 --- a/icons/shield_in_nh_2.svg +++ b/icons/shield_in_nh_2.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/shield_in_nh_3.svg b/icons/shield_in_nh_3.svg index 8b3daed05..86b7ace5c 100644 --- a/icons/shield_in_nh_3.svg +++ b/icons/shield_in_nh_3.svg @@ -1,3 +1,3 @@ - - + + diff --git a/icons/shield_in_nh_4.svg b/icons/shield_in_nh_4.svg index 415f898da..4bd800d9f 100644 --- a/icons/shield_in_nh_4.svg +++ b/icons/shield_in_nh_4.svg @@ -1,3 +1,3 @@ - - + + diff --git a/icons/shield_kr_expressway_2.svg b/icons/shield_kr_expressway_2.svg index c74b8ea03..7bb5a8918 100644 --- a/icons/shield_kr_expressway_2.svg +++ b/icons/shield_kr_expressway_2.svg @@ -1,6 +1,4 @@ - - - - + + diff --git a/icons/shield_kr_expressway_3.svg b/icons/shield_kr_expressway_3.svg index b6c43ffe7..a2b1100c5 100644 --- a/icons/shield_kr_expressway_3.svg +++ b/icons/shield_kr_expressway_3.svg @@ -1,6 +1,4 @@ - - - - + + diff --git a/icons/shield_us_fl_toll.svg b/icons/shield_us_fl_toll.svg index 1c83dbe7b..5c0d2ba74 100644 --- a/icons/shield_us_fl_toll.svg +++ b/icons/shield_us_fl_toll.svg @@ -1,7 +1,5 @@ - - - + + + - - diff --git a/icons/shield_us_ut_2.svg b/icons/shield_us_ut_2.svg index 598cb1678..a9e493979 100644 --- a/icons/shield_us_ut_2.svg +++ b/icons/shield_us_ut_2.svg @@ -1,4 +1,4 @@ - - + + diff --git a/icons/shield_us_ut_3.svg b/icons/shield_us_ut_3.svg index 946896860..1895ac7f2 100644 --- a/icons/shield_us_ut_3.svg +++ b/icons/shield_us_ut_3.svg @@ -1,4 +1,4 @@ - - + + diff --git a/scripts/build.ts b/scripts/build.ts index 69254cbec..1ba418418 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -25,9 +25,13 @@ const buildWith = async ( await mkdir("dist", { recursive: true }); await Promise.all( - ["index.html", "bare_map.html", "shieldtest.html", "favicon.ico"].map((f) => - copyFile(`src/${f}`, `dist/${f}`) - ) + [ + "index.html", + "bare_map.html", + "shieldtest.html", + "favicon.ico", + "fonts.css", + ].map((f) => copyFile(`src/${f}`, `dist/${f}`)) ); const localConfig = await maybeLocalConfig(); diff --git a/shieldlib/src/screen_gfx.ts b/shieldlib/src/screen_gfx.ts index e3fe2b55c..eec3087e8 100644 --- a/shieldlib/src/screen_gfx.ts +++ b/shieldlib/src/screen_gfx.ts @@ -4,7 +4,7 @@ import rgba from "color-rgba"; const defaultFontFamily = '"sans-serif-condensed", "Arial Narrow", sans-serif'; export const shieldFont = (size: number, fontFamily: string) => - `bold ${size}px ${fontFamily || defaultFontFamily}`; + `condensed 500 ${size}px ${fontFamily || defaultFontFamily}`; export const fontSizeThreshold = 12; // Replaces `sourceVal` with a blend of `lightenVal` and `darkenVal` proportional to the brightness; diff --git a/shieldlib/src/shield_helper.ts b/shieldlib/src/shield_helper.ts index f70c8b0b4..da386c6e6 100644 --- a/shieldlib/src/shield_helper.ts +++ b/shieldlib/src/shield_helper.ts @@ -188,12 +188,12 @@ export function fishheadDownShield( outlineWidth: 1, }, }, - textLayout: textConstraint("roundedRect"), + textLayout: textConstraint("ellipse"), padding: { - left: 3, - right: 3, - top: 2, - bottom: 6, + left: 1, + right: 1, + top: 1, + bottom: 5, }, textColor, }; diff --git a/src/fonts.css b/src/fonts.css new file mode 100644 index 000000000..e0df38be9 --- /dev/null +++ b/src/fonts.css @@ -0,0 +1,18 @@ +@font-face { + font-family: "Noto Sans Condensed"; + src: url("https://osm-americana.github.io/web-fonts/noto/NotoSans-CondensedMedium-PropNums.woff2") + format("woff2"), + url("https://osm-americana.github.io/web-fonts/noto/NotoSans-CondensedMedium-PropNums.woff") + format("woff"); + font-weight: 500; + font-style: normal; +} +@font-face { + font-family: "Noto Sans Armenian Condensed"; + src: url("https://github.com/osm-americana/web-fonts/raw/main/noto/NotoSansArmenian-CondensedMedium-PropNums.woff2") + format("woff2"), + url("https://github.com/osm-americana/web-fonts/raw/main/noto/NotoSansArmenian-CondensedMedium-PropNums.woff") + format("woff"); + font-weight: 500; + font-style: normal; +} diff --git a/src/index.html b/src/index.html index 3a828f824..89a840fd2 100644 --- a/src/index.html +++ b/src/index.html @@ -3,6 +3,8 @@ OpenStreetMap Americana + + +

+ Invisible text so the font will load early +

Shield Test - - - + +