import type { StyleSpecification } from 'maplibre-gl'; const NAUTICAL_STYLE_URL = 'https://tiles.gcnautical.com/styles/nautical.json'; const SERVER_FONTS = ['Noto Sans CJK KR Regular', 'Noto Sans Regular']; export async function fetchEncStyle(signal: AbortSignal): Promise { const res = await fetch(NAUTICAL_STYLE_URL, { signal }); if (!res.ok) throw new Error(`ENC style fetch failed: ${res.status}`); const style = (await res.json()) as StyleSpecification; for (const layer of style.layers) { const layout = (layer as { layout?: Record }).layout; if (!layout) continue; const tf = layout['text-font']; if (Array.isArray(tf) && tf.every((v) => typeof v === 'string')) { layout['text-font'] = SERVER_FONTS; } } return style; }