Skip to content

Commit

Permalink
another one try on fix issue #19
Browse files Browse the repository at this point in the history
  • Loading branch information
Beeblerox committed Oct 10, 2014
1 parent 58e33e5 commit 124251e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Haxe/lib/bitmapFont/BitmapFont.hx
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class BitmapFont
* @param useColor Whether to use color transformation for glyphs.
* @return Generated collection of BitmapGlyph objects. They are used for rendering text and borders in RENDER_BLIT mode.
*/
public function prepareGlyphs(scale:Float, color:UInt, useColor:Bool = true):BitmapGlyphCollection
public function prepareGlyphs(scale:Float, color:UInt, useColor:Bool = true, smoothing:Bool = true):BitmapGlyphCollection
{
return new BitmapGlyphCollection(this, scale, color, useColor);
}
Expand Down Expand Up @@ -604,18 +604,18 @@ class BitmapGlyphCollection

public var font:BitmapFont;

public function new(font:BitmapFont, scale:Float, color:UInt, useColor:Bool = true)
public function new(font:BitmapFont, scale:Float, color:UInt, useColor:Bool = true, smoothing:Bool = true)
{
glyphMap = new Map<Int, BitmapGlyph>();
glyphs = new Array<BitmapGlyph>();
this.font = font;
this.scale = scale;
this.color = (useColor) ? color : 0xFFFFFFFF;
this.minOffsetX = font.minOffsetX * scale;
prepareGlyphs();
prepareGlyphs(smoothing);
}

private function prepareGlyphs():Void
private function prepareGlyphs(smoothing:Bool = true):Void
{
var matrix:Matrix = new Matrix();
matrix.scale(scale, scale);
Expand Down Expand Up @@ -648,9 +648,9 @@ class BitmapGlyphCollection
preparedBD = new BitmapData(bdWidth, bdHeight, true, 0x00000000);

#if !js
preparedBD.draw(glyphBD, matrix, colorTransform);
preparedBD.draw(glyphBD, matrix, colorTransform, null, null, smoothing);
#else
preparedBD.draw(glyphBD, matrix);
preparedBD.draw(glyphBD, matrix, null, null, null, smoothing);
preparedBD.colorTransform(preparedBD.rect, colorTransform);
#end

Expand Down
4 changes: 2 additions & 2 deletions Haxe/lib/bitmapFont/BitmapTextField.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ class BitmapTextField extends Sprite
{
textGlyphs.dispose();
}
textGlyphs = font.prepareGlyphs(size, textColor, useTextColor);
textGlyphs = font.prepareGlyphs(size, textColor, useTextColor, smoothing);
#end

_pendingTextGlyphsChange = false;
Expand All @@ -1567,7 +1567,7 @@ class BitmapTextField extends Sprite
{
borderGlyphs.dispose();
}
borderGlyphs = font.prepareGlyphs(size, borderColor);
borderGlyphs = font.prepareGlyphs(size, borderColor, true, smoothing);
}
#end

Expand Down
2 changes: 1 addition & 1 deletion Haxe/lib/haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"tags": ["game", "openfl", "flash", "neko", "cpp", "android", "ios", "cross"],
"description": "Component for rendering text with bitmap font on all openfl targets.",
"releasenote": "angel code parsing fix, changing the way of storing font glyphs, fixes for rendering on html5 target",
"releasenote": "angel code parsing fix, changing the way of storing font glyphs, added text smoothing, fixes for rendering on html5 target",
"version": "0.9.3",
"contributors": ["Beeblerox"],
"dependencies": { "lime": "", "openfl": "" }
Expand Down

0 comments on commit 124251e

Please sign in to comment.