Skip to content

Commit

Permalink
Do not rotate non-CJK characters in vertical writing mode (fixes #3506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Nov 4, 2016
1 parent 97ef972 commit 0f74511
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/symbol/shaping.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function shapeText(text, glyphs, maxWidth, lineHeight, horizontalAlign, vertical

if (!glyph && codePoint !== newLine) continue;

if (writingMode === WritingMode.horizontal) {
if (!scriptDetection.charAllowsVerticalWritingMode(text[i]) || writingMode === WritingMode.horizontal) {
positionedGlyphs.push(new PositionedGlyph(codePoint, x, yOffset, glyph, 0));
if (glyph) x += glyph.advance + spacing;

Expand Down
4 changes: 2 additions & 2 deletions js/util/script_detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports.allowsIdeographicBreaking = function(chars) {

module.exports.allowsVerticalWritingMode = function(chars) {
for (const char of chars) {
if (charAllowsVerticalWritingMode(char.charCodeAt(0))) return true;
if (exports.charAllowsVerticalWritingMode(char.charCodeAt(0))) return true;
}
return false;
};
Expand Down Expand Up @@ -45,7 +45,7 @@ module.exports.charAllowsIdeographicBreaking = function(char) {
return false;
};

function charAllowsVerticalWritingMode(char) {
exports.charAllowsVerticalWritingMode = function(char) {
// Return early for characters outside all ranges that allow the vertical
// writing mode.
if (char < 0x1100) return false;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"highlight.js": "9.3.0",
"jsdom": "^9.4.2",
"lodash.template": "^4.4.0",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#20289f25516b28d5f5af4f5813659c2d8139fa6d",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#3462d7e88372be4df11e1ef8c1991bcf3e31aa93",
"minifyify": "^7.0.1",
"npm-run-all": "^3.0.0",
"nyc": "^8.3.0",
Expand Down

0 comments on commit 0f74511

Please sign in to comment.