mapbox / mapbox-gl-rtl-text

Add right-to-left text support to Mapbox GL JS
Other
53 stars 20 forks source link

v0.3.0: Switch to WASM, rewrite build pipeline #32

Closed stepankuzmin closed 2 months ago

stepankuzmin commented 3 months ago

The API for the GL JS interoperability the same:

mapboxgl.setRTLTextPlugin('mapbox-gl-rtl-text.js');

// or
mapboxgl.setRTLTextPlugin(
      'node_modules/@mapbox/mapbox-gl-rtl-text/dist/mapbox-gl-rtl-text.js',
      null,
      false
);

The NPM package now exports UMD with a pending promise as a default export (see src/index.js). The promise is resolved to previously exported functions:

import rtlText from '@mapbox/mapbox-gl-rtl-text';
const {applyArabicShaping, processBidirectionalText} = await rtlText;

const arabicString = "سلام";
const shapedArabicText = applyArabicShaping(arabicString);
const readyForDisplay = processBidirectionalText(shapedArabicText, []);

Before v0.2.3

Screenshot 2024-06-14 at 17 28 14 before

After

There is no visual change compared with the latest stable v0.2.3.

Screenshot 2024-06-14 at 17 28 42 after

Supersedes https://github.com/mapbox/mapbox-gl-rtl-text/pull/30 Closes https://github.com/mapbox/mapbox-gl-rtl-text/pull/30 https://github.com/mapbox/mapbox-gl-rtl-text/pull/26