You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/05/29 10:31:48 UTC

[incubator-baremaps-site] branch main updated: Add maplibre RTL text plugin to improve text rendering. (#30)

This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 0a9d77c  Add maplibre RTL text plugin to improve text rendering. (#30)
0a9d77c is described below

commit 0a9d77c04aed6fb8215889993fa1c177e889b5ca
Author: Brandon Liu <bd...@users.noreply.github.com>
AuthorDate: Mon May 29 18:31:42 2023 +0800

    Add maplibre RTL text plugin to improve text rendering. (#30)
---
 src/components/map/index.tsx | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/components/map/index.tsx b/src/components/map/index.tsx
index d98cdc4..054731f 100644
--- a/src/components/map/index.tsx
+++ b/src/components/map/index.tsx
@@ -62,6 +62,14 @@ export default function Map({
 
   // Initialize map when component mounts
   useEffect(() => {
+    if (maplibregl.getRTLTextPluginStatus() === 'unavailable') {
+      maplibregl.setRTLTextPlugin(
+        'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js',
+        null,
+        true
+      );
+    }
+
     const initMap = async () => {
       if (ipToLoc) {
         try {