diff --git a/Extensions/TextObject/TextObject.cpp b/Extensions/TextObject/TextObject.cpp index 5a1f63268d..cc9999b583 100644 --- a/Extensions/TextObject/TextObject.cpp +++ b/Extensions/TextObject/TextObject.cpp @@ -274,7 +274,7 @@ bool RuntimeTextObject::ChangeProperty(std::size_t propertyNb, } else if (propertyNb == 1) { ChangeFont(newValue); } else if (propertyNb == 2) { - SetCharacterSize(newValue.To()); + SetCharacterSize(std::max(1, newValue.To())); } else if (propertyNb == 3) { gd::String r, gb, g, b; { @@ -297,7 +297,7 @@ bool RuntimeTextObject::ChangeProperty(std::size_t propertyNb, SetColor(r.To(), g.To(), b.To()); } else if (propertyNb == 4) { - SetOpacity(newValue.To()); + SetOpacity(std::min(std::max(0.0f, newValue.To()), 255.0f)); } else if (propertyNb == 5) { SetSmooth(!(newValue == _("No"))); } diff --git a/Extensions/TextObject/textruntimeobject.js b/Extensions/TextObject/textruntimeobject.js index 303428e203..f52a6dd6ca 100644 --- a/Extensions/TextObject/textruntimeobject.js +++ b/Extensions/TextObject/textruntimeobject.js @@ -14,7 +14,7 @@ gdjs.TextRuntimeObject = function(runtimeScene, objectData) { gdjs.RuntimeObject.call(this, runtimeScene, objectData); - this._characterSize = objectData.characterSize; + this._characterSize = Math.max(1, objectData.characterSize); this._fontName = objectData.font; this._bold = objectData.bold; this._italic = objectData.italic; diff --git a/newIDE/app/src/ObjectsRendering/Renderers/RenderedTextInstance.js b/newIDE/app/src/ObjectsRendering/Renderers/RenderedTextInstance.js index 187346b0fe..1205cb81c6 100644 --- a/newIDE/app/src/ObjectsRendering/Renderers/RenderedTextInstance.js +++ b/newIDE/app/src/ObjectsRendering/Renderers/RenderedTextInstance.js @@ -87,7 +87,7 @@ RenderedTextInstance.prototype.update = function() { if (this._styleFontDirty) { this._pixiObject.style.fontFamily = this._fontFamily || 'Arial'; - this._pixiObject.style.fontSize = this._characterSize + 'px'; + this._pixiObject.style.fontSize = Math.max(1, this._characterSize) + 'px'; this._pixiObject.style.fontStyle = this._isItalic ? 'italic' : 'normal'; this._pixiObject.style.fontWeight = this._isBold ? 'bold' : 'normal'; this._pixiObject.style.wordWrap = this._wrapping;