Skip to content

Commit 27ba712

Browse files
committed
Reversed 'thickness' and 'outlineThickness' logic to better fit their names.
1 parent bf0e87a commit 27ba712

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Finally you can create the `OutlinedText` object and pass into it the previously
1818
`var txt:OutlinedText = new OutlinedText( fnt );`
1919
By default `OutlinedText` does not display any outlines, so you need to enable them by setting the `outline` property to `true`. Now only thing left to do is to mess around with `OutlinedText`'s properties to create the desired look.
2020

21-
*Thickness* controls the cut off point for the font rendering. It's the same value as `alphaCutoff` passed to the `toSdfFont` method.
21+
*Thickness* controls the cut off point for the font rendering. It's the same value as `alphaCutoff` passed to the `toSdfFont` method but used with reversed logic (ie. `alphaCutoff = 0.2` will result in `thickness = 0.8`).
2222
![Thickness example!](/docs/thickness.png)
2323

2424
*Smoothness* controls the blur on the edges of the rendered font. It's the same value as `smoothing` passed to the `toSdfFont` method.

bin/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7304,15 +7304,15 @@ h2d_OutlinedText.prototype = $extend(h2d_Text.prototype,{
73047304
return value;
73057305
}
73067306
,get_thickness: function() {
7307-
return this._thickness;
7307+
return 1 - this._thickness;
73087308
}
73097309
,set_thickness: function(value) {
73107310
if(value < 0) {
73117311
value = 0;
73127312
} else if(value > 1) {
73137313
value = 1;
73147314
}
7315-
this._thickness = value;
7315+
this._thickness = 1 - value;
73167316
this.__syncOutline();
73177317
return value;
73187318
}
@@ -7341,15 +7341,15 @@ h2d_OutlinedText.prototype = $extend(h2d_Text.prototype,{
73417341
return value;
73427342
}
73437343
,get_outlineThickness: function() {
7344-
return this._outlineThickness;
7344+
return 1 - this._outlineThickness;
73457345
}
73467346
,set_outlineThickness: function(value) {
73477347
if(value < 0) {
73487348
value = 0;
73497349
} else if(value > 1) {
73507350
value = 1;
73517351
}
7352-
this._outlineThickness = value;
7352+
this._outlineThickness = 1 - value;
73537353
this.__syncOutline();
73547354
return value;
73557355
}

bin/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/main.swf

12 Bytes
Binary file not shown.

docs/outlineThickness.png

8.57 KB
Loading

docs/thickness.png

859 Bytes
Loading

main.hl

30 Bytes
Binary file not shown.

src/h2d/OutlinedText.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class OutlinedText extends Text {
6262
Percentile value (0.0 - 1.0) of the distance cutoff point (same as 'alphaCutoff' in `BitmapFont.toSdfFont`)
6363
**/
6464
public var thickness(get, set):Float;
65-
function get_thickness():Float { return _thickness; }
65+
function get_thickness():Float { return 1 - _thickness; }
6666
function set_thickness(value:Float):Float {
6767
if( value < 0 ) value = 0;
6868
else if( value > 1 ) value = 1;
69-
_thickness = value;
69+
_thickness = 1 - value;
7070
__syncOutline();
7171
return value;
7272
}
@@ -109,11 +109,11 @@ class OutlinedText extends Text {
109109
Outlines are rendered in the range between this value and the `thickness` value.
110110
**/
111111
public var outlineThickness(get, set):Float;
112-
function get_outlineThickness():Float { return _outlineThickness; }
112+
function get_outlineThickness():Float { return 1 - _outlineThickness; }
113113
function set_outlineThickness(value:Float):Float {
114114
if( value < 0 ) value = 0;
115115
else if( value > 1 ) value = 1;
116-
_outlineThickness = value;
116+
_outlineThickness = 1 - value;
117117
__syncOutline();
118118
return value;
119119
}

0 commit comments

Comments
 (0)