Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify script detection using regular expressions #4560

Merged
merged 6 commits into from
Aug 15, 2024

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Aug 14, 2024

Simplified some internationalization-related code to match a given character against a regular expression that tests the Unicode script instead of manually checking whether it falls inside the ranges of a series of Unicode blocks. This is more future-proof because it offloads some decisionmaking onto the browser. Unfortunately, the most verbose methods related to vertical orientation must still be maintained by hand, because the ECMAScript standard doesn’t allow browsers to support the other relevant Unicode character properties. But at least the diff in #4550 will end up a bit shorter as a result.

Fixes #4541.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.03%. Comparing base (7324d9a) to head (8cc71e4).
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4560       +/-   ##
===========================================
+ Coverage   65.31%   88.03%   +22.71%     
===========================================
  Files         247      247               
  Lines       33493    33494        +1     
  Branches     1778     2365      +587     
===========================================
+ Hits        21877    29487     +7610     
+ Misses      10768     3056     -7712     
- Partials      848      951      +103     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/render/glyph_manager.ts Show resolved Hide resolved
src/ui/map.ts Show resolved Hide resolved
src/util/script_detection.ts Show resolved Hide resolved
@1ec5 1ec5 force-pushed the script-detect-regex-4541 branch from 3d20399 to 08b19c7 Compare August 14, 2024 10:27
@1ec5 1ec5 force-pushed the script-detect-regex-4541 branch from 44223a6 to 9dbc7ce Compare August 14, 2024 22:00
@HarelM
Copy link
Collaborator

HarelM commented Aug 15, 2024

I'm having a hard time understanding the difference between the two PR related to these files.
Can we close one of them and move all the changes to one PR?
Currently I'm jumping between one to the other and trying to find the difference, which is less than ideal.
If one could be a PR against another branch or if you want me to merge one of the PR to a branch so that I can see the addition between the two PRs.

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 15, 2024

#4560 is now based on #4560 (this PR). The diff in #4560 is cumulative of both PRs, but for the purpose of that PR, I would ask you to ignore the first five commits and focus on the last three commits. Unfortunately, I can’t tell GitHub to set the target of that branch to this branch, because I created both PRs from a fork.

I recommend first reviewing the changes in #4560 (this PR), as suggested in #4550 (comment). If you agree, merge this PR to main; then #4560 will automatically rebase atop main to become much simpler without these five commits.

@HarelM
Copy link
Collaborator

HarelM commented Aug 15, 2024

Ok, I'll review this first.
Is it ready for review now?

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 15, 2024

Sure, have at it!

@HarelM HarelM enabled auto-merge (squash) August 15, 2024 12:18
@HarelM HarelM merged commit 42d6847 into maplibre:main Aug 15, 2024
15 checks passed
@1ec5 1ec5 deleted the script-detect-regex-4541 branch August 15, 2024 18:50
alexandresoro pushed a commit to alexandresoro/ouca that referenced this pull request Sep 22, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [maplibre-gl](https://maplibre.org/) ([source](https://github.com/maplibre/maplibre-gl-js)) | dependencies | minor | [`4.5.2` -> `4.7.0`](https://renovatebot.com/diffs/npm/maplibre-gl/4.5.2/4.7.0) |

---

### Release Notes

<details>
<summary>maplibre/maplibre-gl-js (maplibre-gl)</summary>

### [`v4.7.0`](https://github.com/maplibre/maplibre-gl-js/blob/HEAD/CHANGELOG.md#470)

[Compare Source](maplibre/maplibre-gl-js@v4.6.0...v4.7.0)

##### ✨ Features and improvements

-   Support multiple layers in `map.on`, `map.once` and `map.off` methods ([#&#8203;4570](maplibre/maplibre-gl-js#4570))
-   Ensure GeoJSON cluster sources emit a console warning if `maxzoom` is less than or equal to `clusterMaxZoom` since in this case you may see unexpected results. ([#&#8203;4604](maplibre/maplibre-gl-js#4604))

##### 🐞 Bug fixes

-   Heatmap Fix for 3D terrain ([#&#8203;4571](maplibre/maplibre-gl-js#4571))
-   Fix Map#off to not remove listener with layer(s) registered with Map#once ([#&#8203;4592](maplibre/maplibre-gl-js#4592))
-   Improve types a bit for `addSource` and `getSource` ([#&#8203;4616](maplibre/maplibre-gl-js#4616))
-   Fix the color near the horizon when terrain is enabled without any sky ([#&#8203;4607](maplibre/maplibre-gl-js#4607))
-   Fix bug where `fitBounds` and `cameraForBounds` would not display across the 180th meridian (antimeridian)
-   Fix white flickering on map resize ([#&#8203;4158](maplibre/maplibre-gl-js#4158))
-   Fixed a performance regression related to symbol placement ([#&#8203;4599](maplibre/maplibre-gl-js#4599))
-   Fix a bug where cloning a Transform instance didn't include the `lngRange`. This caused a bug where
    using `transformCameraUpdate` caused the `maxBounds` to stop working just for east/west bounds. ([#&#8203;4625](maplibre/maplibre-gl-js#4625))

### [`v4.6.0`](https://github.com/maplibre/maplibre-gl-js/blob/HEAD/CHANGELOG.md#460)

[Compare Source](maplibre/maplibre-gl-js@v4.5.2...v4.6.0)

##### ✨ Features and improvements

-   Prefer local glyph rendering for all CJKV characters, not just those in the CJK Unified Ideographs, Hiragana, Katakana, and Hangul Syllables blocks. ([#&#8203;4560](maplibre/maplibre-gl-js#4560)))

##### 🐞 Bug fixes

-   Fix right-to-left layout of labels that contain characters in the Arabic Extended-B code block. ([#&#8203;4536](maplibre/maplibre-gl-js#4536))
-   Fix 3D map freezing when camera is adjusted against map bounds. ([#&#8203;4537](maplibre/maplibre-gl-js#4537))
-   Fix `getStyle()` to return a clone so the object cannot be internally changed ([#&#8203;4488](maplibre/maplibre-gl-js#4488))
-   Fix issues with setting sky to `undefined` ([#&#8203;4587](maplibre/maplibre-gl-js#4587)))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC40Ny4wIiwidXBkYXRlZEluVmVyIjoiMzguODYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Reviewed-on: https://git.tristess.app/alexandresoro/ouca/pulls/52
Reviewed-by: Alexandre Soro <[email protected]>
Co-authored-by: renovate <[email protected]>
Co-committed-by: renovate <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace some manual script detection with regular expressions
3 participants