Skip to content

Commit b5f1663

Browse files
Merge pull request #530 from rdkcentral/release/2.13.0
Release - v2.13.0
2 parents b25dcc1 + 0d399b2 commit b5f1663

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v2.13.0
4+
*11 apr 2024*
5+
6+
- Fixed an issue causing not including TypeScript types in the build. (#527)
7+
- Enhanced handling of bidirectional text in TextTexture by setting canvas context direction to correct display of text blocks in RTL configurations.
8+
39
## v2.12.1
410
*07 feb 2024*
511

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Metrological, Bas van Meurs <b.van.meurs@metrological.com>",
33
"name": "@lightningjs/core",
4-
"version": "2.12.1",
4+
"version": "2.13.0",
55
"license": "Apache-2.0",
66
"type": "module",
77
"types": "dist/src/index.d.ts",

scripts/src-to-dist.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ console.log("Copying all JavaScript source code to ./dist...");
1414
shell.find('./src/')
1515
.filter(file => {
1616
const ext = path.extname(file);
17-
return ['.js', '.mjs', '.d.mts', '.d.ts'].includes(ext) && !file.includes('.test.');
17+
return ['.js', '.mjs', '.mts', '.ts'].includes(ext) && !file.includes('.test.');
1818
})
1919
.forEach(file => {
2020
const distFile = path.join('./dist', file);

src/textures/TextTexture.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@ export default class TextTexture extends Texture {
466466
return this._textIndent;
467467
}
468468

469+
set rtl(v) {
470+
if (this._rtl !== v) {
471+
this._rtl = v;
472+
this._changed();
473+
}
474+
}
475+
476+
get rtl() {
477+
return this._rtl;
478+
}
479+
469480
get precision() {
470481
return super.precision;
471482
}
@@ -620,6 +631,7 @@ export default class TextTexture extends Texture {
620631
if (this.highlightPaddingRight !== 0) nonDefaults["highlightPaddingRight"] = this.highlightPaddingRight;
621632
if (this.letterSpacing !== 0) nonDefaults["letterSpacing"] = this.letterSpacing;
622633
if (this.textIndent !== 0) nonDefaults["textIndent"] = this.textIndent;
634+
if (this.rtl !== 0) nonDefaults["rtl"] = this.rtl;
623635

624636
if (this.cutSx) nonDefaults["cutSx"] = this.cutSx;
625637
if (this.cutEx) nonDefaults["cutEx"] = this.cutEx;
@@ -667,6 +679,7 @@ export default class TextTexture extends Texture {
667679
obj.highlightPaddingRight = this._highlightPaddingRight;
668680
obj.letterSpacing = this._letterSpacing;
669681
obj.textIndent = this._textIndent;
682+
obj.rtl = this._rtl;
670683
obj.cutSx = this._cutSx;
671684
obj.cutEx = this._cutEx;
672685
obj.cutSy = this._cutSy;
@@ -714,6 +727,7 @@ proto._highlightPaddingLeft = 0;
714727
proto._highlightPaddingRight = 0;
715728
proto._letterSpacing = 0;
716729
proto._textIndent = 0;
730+
proto._rtl = 0;
717731
proto._cutSx = 0;
718732
proto._cutEx = 0;
719733
proto._cutSy = 0;

src/textures/TextTextureRenderer.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default class TextTextureRenderer {
4343
this._stage.getOption('defaultFontFace'),
4444
);
4545
this._context.textBaseline = this._settings.textBaseline;
46+
this._context.direction = this._settings.rtl ? "rtl" : "ltr";
4647
};
4748

4849
_load() {
@@ -306,6 +307,9 @@ export default class TextTextureRenderer {
306307
linePositionX += ((renderInfo.innerWidth - renderInfo.lineWidths[i]) / 2);
307308
}
308309
linePositionX += renderInfo.paddingLeft;
310+
if (this._settings.rtl) {
311+
linePositionX += renderInfo.lineWidths[i];
312+
}
309313

310314
drawLines.push({text: renderInfo.lines[i], x: linePositionX, y: linePositionY, w: renderInfo.lineWidths[i]});
311315
}

0 commit comments

Comments
 (0)