{"id":14845508,"url":"https://github.com/mapbox/mapbox-gl-rtl-text","last_synced_at":"2025-09-18T04:32:48.785Z","repository":{"id":45059005,"uuid":"75106355","full_name":"mapbox/mapbox-gl-rtl-text","owner":"mapbox","description":"Add right-to-left text support to Mapbox GL JS","archived":false,"fork":false,"pushed_at":"2024-07-26T00:21:24.000Z","size":1498,"stargazers_count":53,"open_issues_count":6,"forks_count":20,"subscribers_count":109,"default_branch":"main","last_synced_at":"2024-08-26T11:39:45.648Z","etag":null,"topics":["icu","mapbox-gl","mapbox-gl-js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-29T17:42:14.000Z","updated_at":"2024-08-26T11:39:45.649Z","dependencies_parsed_at":"2024-07-24T10:52:06.624Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/mapbox-gl-rtl-text","commit_stats":{"total_commits":62,"total_committers":9,"mean_commits":6.888888888888889,"dds":"0.30645161290322576","last_synced_commit":"4ba8fa31f3ce449e8f7dee8191ab3e54a19982e9"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-gl-rtl-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-gl-rtl-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-gl-rtl-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-gl-rtl-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/mapbox-gl-rtl-text/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219856535,"owners_count":16553564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["icu","mapbox-gl","mapbox-gl-js"],"created_at":"2024-09-19T13:00:33.110Z","updated_at":"2025-09-18T04:32:43.483Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","funding_links":[],"categories":["Map Rendering Plugins"],"sub_categories":["JavaScript"],"readme":"# mapbox-gl-rtl-text.js\n\n[![CI](https://github.com/mapbox/mapbox-gl-rtl-text/actions/workflows/ci.yml/badge.svg)](https://github.com/mapbox/mapbox-gl-rtl-text/actions/workflows/ci.yml)\n\nAn [Emscripten](https://github.com/emscripten-core/emscripten) port of a subset of the functionality of [International Components for Unicode (ICU)](http://site.icu-project.org/) necessary for [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) to support [right to left text rendering](https://github.com/mapbox/mapbox-gl/issues/4). Supports the Arabic and Hebrew languages, which are written right-to-left. Mapbox Studio loads this plugin by default.\n\n**Requires [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js) (version 0.32.1 and up).**\n\nA map that requires Arabic names should at a minimum install the `mapbox-gl-rtl-text` plugin. To display the actual place names, the map could use a specially modified style, manipulate the style at runtime, or install the [`mapbox-gl-language`](https://github.com/mapbox/mapbox-gl-language/) plugin for convenience. The `mapbox-gl-language` plugin displays Arabic name data (among other languages), while the `mapbox-gl-rtl-text` plugin adds support for displaying Arabic names.\n\n## Using mapbox-gl-rtl-text\n\nmapbox-gl-rtl-text exposes two functions:\n\n### `applyArabicShaping(unicodeInput)`\n\nTakes an input string in \"logical order\" (i.e. characters in the order they are typed, not the order they will be displayed) and replaces Arabic characters with the \"presentation form\" of the character that represents the appropriate glyph based on the character's location within a word.\n\n### `processBidirectionalText(unicodeInput, lineBreakPoints)`\n\nTakes an input string with characters in \"logical order\", along with a set of chosen line break points, and applies the [Unicode Bidirectional Algorithm](http://unicode.org/reports/tr9/) to the string. Returns an ordered set of lines with characters in \"visual order\" (i.e. characters in the order they are displayed, left-to-right). The algorithm will insert mandatory line breaks (`\\n` etc.) if they are not already included in `lineBreakPoints`.\n\n`mapbox-gl-rtl-text.js` is built to be loaded directly by Mapbox GL JS using:\n\n```js\nmapboxgl.setRTLTextPlugin('mapbox-gl-rtl-text.js');\n```\n\n You can use ICU JS directly:\n```js\nimport rtlText from '@mapbox/mapbox-gl-rtl-text';\nconst {applyArabicShaping, processBidirectionalText} = await rtlText;\n\nconst arabicString = \"سلام\";\nconst shapedArabicText = applyArabicShaping(arabicString);\nconst readyForDisplay = processBidirectionalText(shapedArabicText, []);\n```\n\n## Building mapbox-gl-rtl-text\n\n* Running `npm start` will spin up a local server to test the plugin in a browser.\n* Running `npm test` will run unit tests in `test.js`.\n* Running `npm run build:icu` will rebuild ICU WASM module:\n  - Download Emscripten SDK Docker Image\n  - Compile `ushape_wrapper.c` and `ubidi_wrapper.c` to LLVM bytecode\n  - Generate `./src/icu.wasm.js`, exposing bytecode sources as WASM module\n\n## Deploying mapbox-gl-rtl-text\n\n```\nnpm test\nnpm version {patch|minor|major}\ngit push --follow-tags\n\nmbx env\nVERSION=v$(node -p \"require('./package.json').version\")\naws s3 cp --acl public-read --content-type application/javascript mapbox-gl-rtl-text.js s3://mapbox-gl-js/plugins/mapbox-gl-rtl-text/v$VERSION/mapbox-gl-rtl-text.js\nmbx npm publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fmapbox-gl-rtl-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fmapbox-gl-rtl-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fmapbox-gl-rtl-text/lists"}