Skip to content

Commit

Permalink
add twitter-cldr for bidirectional text support
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemorris committed Dec 15, 2015
1 parent ba9d109 commit ed975d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/symbol/resolve_text.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

var resolveTokens = require('../util/token');
var TwitterCLDR = require('../../node_modules/twitter_cldr/min/en.min.js');
var bidi = TwitterCLDR.Bidi;

module.exports = resolveText;

Expand Down Expand Up @@ -29,6 +31,8 @@ function resolveText(features, layoutProperties, codepoints) {
text = text.toLocaleLowerCase();
}

text = bidi.from_string(text).reorder_visually().toString();

for (var j = 0; j < text.length; j++) {
codepoints[text.charCodeAt(j)] = true;
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"rbush": "^1.4.0",
"request": "^2.39.0",
"resolve-url": "^0.2.1",
"twitter_cldr": "^1.5.0",
"unassertify": "^2.0.0",
"unitbezier": "^0.0.0",
"vector-tile": "^1.2.0",
Expand Down

0 comments on commit ed975d5

Please sign in to comment.