Signed Distance Field MeshStyle

author:
Alexandr
description:
Allows draw signed distance fields
compatible:
v2.0
tag:
style, textfield
homepage:
https://gist.github.com/Maligan/179d9211aede3c013f83e42f8d3d2718

WARNING

Now starling support this feature from the box, please read manual
Distance Field Fonts.

Demo

Overview

Signed distance field rendering is a technique that allows render bitmap fonts with crispy result while upscaling.

If you have not heard anything about this before, please, read this libgdx article.
For creating distance field font you can use littera.
For usage this amazing trick simply change style property on your TextField or Mesh:

textField.style = new SignedDistanceFieldStyle(4.0);

Constructor takes one argument - spread this value depends on distance field bitmap creating and define edge sharpness, just change it if you want to make edges less or more smooth.

Style tracks only DisplayObject scale and do not tracks TextField front size, you need multiply spread by ratio base font size and current font size.

Changelog

  • 2016/07/09 18:54: First public version

User Comments

Feel free to edit this part of the page if you want to add information that's lacking in the above description.
Questions are better asked in the forum, though.

  extensions/signed-distance-field.txt · Last modified: 2021/01/07 16:44 by daniel
 
Powered by DokuWiki