Skip to content

Commit

Permalink
Merge pull request #530 from rdkcentral/release/2.13.0
Browse files Browse the repository at this point in the history
Release - v2.13.0
  • Loading branch information
michielvandergeest authored Apr 12, 2024
2 parents b25dcc1 + 0d399b2 commit b5f1663
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v2.13.0
*11 apr 2024*

- Fixed an issue causing not including TypeScript types in the build. (#527)
- Enhanced handling of bidirectional text in TextTexture by setting canvas context direction to correct display of text blocks in RTL configurations.

## v2.12.1
*07 feb 2024*

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Metrological, Bas van Meurs <[email protected]>",
"name": "@lightningjs/core",
"version": "2.12.1",
"version": "2.13.0",
"license": "Apache-2.0",
"type": "module",
"types": "dist/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion scripts/src-to-dist.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ console.log("Copying all JavaScript source code to ./dist...");
shell.find('./src/')
.filter(file => {
const ext = path.extname(file);
return ['.js', '.mjs', '.d.mts', '.d.ts'].includes(ext) && !file.includes('.test.');
return ['.js', '.mjs', '.mts', '.ts'].includes(ext) && !file.includes('.test.');
})
.forEach(file => {
const distFile = path.join('./dist', file);
Expand Down
14 changes: 14 additions & 0 deletions src/textures/TextTexture.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,17 @@ export default class TextTexture extends Texture {
return this._textIndent;
}

set rtl(v) {
if (this._rtl !== v) {
this._rtl = v;
this._changed();
}
}

get rtl() {
return this._rtl;
}

get precision() {
return super.precision;
}
Expand Down Expand Up @@ -620,6 +631,7 @@ export default class TextTexture extends Texture {
if (this.highlightPaddingRight !== 0) nonDefaults["highlightPaddingRight"] = this.highlightPaddingRight;
if (this.letterSpacing !== 0) nonDefaults["letterSpacing"] = this.letterSpacing;
if (this.textIndent !== 0) nonDefaults["textIndent"] = this.textIndent;
if (this.rtl !== 0) nonDefaults["rtl"] = this.rtl;

if (this.cutSx) nonDefaults["cutSx"] = this.cutSx;
if (this.cutEx) nonDefaults["cutEx"] = this.cutEx;
Expand Down Expand Up @@ -667,6 +679,7 @@ export default class TextTexture extends Texture {
obj.highlightPaddingRight = this._highlightPaddingRight;
obj.letterSpacing = this._letterSpacing;
obj.textIndent = this._textIndent;
obj.rtl = this._rtl;
obj.cutSx = this._cutSx;
obj.cutEx = this._cutEx;
obj.cutSy = this._cutSy;
Expand Down Expand Up @@ -714,6 +727,7 @@ proto._highlightPaddingLeft = 0;
proto._highlightPaddingRight = 0;
proto._letterSpacing = 0;
proto._textIndent = 0;
proto._rtl = 0;
proto._cutSx = 0;
proto._cutEx = 0;
proto._cutSy = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/textures/TextTextureRenderer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class TextTextureRenderer {
this._stage.getOption('defaultFontFace'),
);
this._context.textBaseline = this._settings.textBaseline;
this._context.direction = this._settings.rtl ? "rtl" : "ltr";
};

_load() {
Expand Down Expand Up @@ -306,6 +307,9 @@ export default class TextTextureRenderer {
linePositionX += ((renderInfo.innerWidth - renderInfo.lineWidths[i]) / 2);
}
linePositionX += renderInfo.paddingLeft;
if (this._settings.rtl) {
linePositionX += renderInfo.lineWidths[i];
}

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

0 comments on commit b5f1663

Please sign in to comment.