Skip to content

Commit

Permalink
Update to mapbox-gl-rtl-text 0.2.0 for formatted text support.
Browse files Browse the repository at this point in the history
Add test using new formatted RTL functionality.
  • Loading branch information
ChrisLoer committed Aug 8, 2018
1 parent 1112423 commit 6796176
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 7 deletions.
2 changes: 1 addition & 1 deletion debug/csp.html
Expand Up @@ -27,7 +27,7 @@
hash: true
});

mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js');
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');

</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/example/mapbox-gl-rtl-text.html
@@ -1,7 +1,7 @@
<div id='map'></div>

<script>
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js');
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');

var map = new mapboxgl.Map({
container: 'map',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@mapbox/batfish": "^1.0.4",
"@mapbox/flow-remove-types": "^1.3.0-await.upstream.1",
"@mapbox/mapbox-gl-rtl-text": "^0.1.2",
"@mapbox/mapbox-gl-rtl-text": "^0.2.0",
"@mapbox/mapbox-gl-test-suite": "file:test/integration",
"@octokit/rest": "^15.9.5",
"babel-eslint": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -96,7 +96,7 @@ const exported = {
* @param {string} pluginURL URL pointing to the Mapbox RTL text plugin source.
* @param {Function} callback Called with an error argument if there is an error.
* @example
* mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js');
* mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
* @see [Add support for right-to-left scripts](https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/)
*/

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,61 @@
{
"version": 8,
"metadata": {
"test": {
"height": 256,
"width": 256
}
},
"center": [ 0, 0 ],
"zoom": 0,
"sources": {
"point": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "بغداد",
"name_en": "Baghdad"
},
"geometry": {
"type": "Point",
"coordinates": [ 0, 0 ]
}
}
]
}
}
},
"glyphs": "local://glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "text",
"type": "symbol",
"source": "point",
"layout": {
"text-field": ["format",
["get", "name"], { "font-scale": 1.5 },
" ", {},
["get", "name_en"], { "font-scale": 0.5, "text-font": ["literal", [ "NotoCJK" ]] },
" ", {},
["get", "name"], { "font-scale": 1.5 },
" ", {},
["get", "name_en"], { "font-scale": 0.5, "text-font": ["literal", [ "NotoCJK" ]] },
" ", {},
["get", "name"], { "font-scale": 1.5 },
" ", {},
["get", "name_en"], { "font-scale": 0.5, "text-font": ["literal", [ "NotoCJK" ]] }
],
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
],
"text-size": 24,
"text-max-width": 10
}
}
]
}
1 change: 1 addition & 0 deletions test/suite_implementation.js
Expand Up @@ -10,6 +10,7 @@ import path from 'path';

rtlTextPlugin['applyArabicShaping'] = rtlText.applyArabicShaping;
rtlTextPlugin['processBidirectionalText'] = rtlText.processBidirectionalText;
rtlTextPlugin['processStyledBidirectionalText'] = rtlText.processStyledBidirectionalText;

module.exports = function(style, options, _callback) { // eslint-disable-line import/no-commonjs
let wasCallbackCalled = false;
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -144,9 +144,9 @@
version "1.0.0"
resolved "https://registry.yarnpkg.com/@mapbox/link-to-location/-/link-to-location-1.0.0.tgz#484a4d922e3e6f7b54fd7964d8035bcb00bbf59a"

"@mapbox/mapbox-gl-rtl-text@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@mapbox/mapbox-gl-rtl-text/-/mapbox-gl-rtl-text-0.1.2.tgz#c6bdcc05ac71c1caa4dfa09022466d1e278083bc"
"@mapbox/mapbox-gl-rtl-text@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@mapbox/mapbox-gl-rtl-text/-/mapbox-gl-rtl-text-0.2.0.tgz#332fa991dcf6913be369c21f4c20c6c73b5d1c8c"

"@mapbox/mapbox-gl-supported@^1.4.0":
version "1.4.0"
Expand Down

0 comments on commit 6796176

Please sign in to comment.