diff --git a/src/data/bucket/symbol_bucket.js b/src/data/bucket/symbol_bucket.js index 2369e6029c5..1a64a3706b3 100644 --- a/src/data/bucket/symbol_bucket.js +++ b/src/data/bucket/symbol_bucket.js @@ -25,7 +25,7 @@ import {ProgramConfigurationSet} from '../program_configuration'; import {TriangleIndexArray, LineIndexArray} from '../index_array_type'; import transformText from '../../symbol/transform_text'; import mergeLines from '../../symbol/mergelines'; -import {allowsVerticalWritingMode} from '../../util/script_detection'; +import {allowsVerticalWritingMode, stringContainsRTLText} from '../../util/script_detection'; import {WritingMode} from '../../symbol/shaping'; import loadGeometry from '../load_geometry'; import mvt from '@mapbox/vector-tile'; @@ -131,6 +131,15 @@ function addDynamicAttributes(dynamicLayoutVertexArray: StructArray, p: Point, a dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle); } +function containsRTLText(formattedText: Formatted): boolean { + for (const section of formattedText.sections) { + if (stringContainsRTLText(section.text)) { + return true; + } + } + return false; +} + export class SymbolBuffers { layoutVertexArray: SymbolLayoutArray; layoutVertexBuffer: VertexBuffer; @@ -423,7 +432,7 @@ class SymbolBucket implements Bucket { // conversion here. const resolvedTokens = layer.getValueAndResolveTokens('text-field', feature, availableImages); const formattedText = Formatted.factory(resolvedTokens); - if (formattedText.containsRTLText()) { + if (containsRTLText(formattedText)) { this.hasRTLText = true; } if ( diff --git a/src/style-spec/expression/types/formatted.js b/src/style-spec/expression/types/formatted.js index 726242ea30f..378a0a2bd5d 100644 --- a/src/style-spec/expression/types/formatted.js +++ b/src/style-spec/expression/types/formatted.js @@ -1,6 +1,4 @@ // @flow - -import {stringContainsRTLText} from "../../../util/script_detection"; import type Color from '../../util/color'; import type ResolvedImage from '../types/resolved_image'; @@ -50,15 +48,6 @@ export default class Formatted { return this.sections.map(section => section.text).join(''); } - containsRTLText(): boolean { - for (const section of this.sections) { - if (stringContainsRTLText(section.text)) { - return true; - } - } - return false; - } - serialize(): Array { const serialized: Array = ["format"]; for (const section of this.sections) {