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 eedb1a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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

0 comments on commit eedb1a0

Please sign in to comment.