font-atlas-sdf

WebJar for font-atlas-sdf

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

font-atlas-sdf
Last Version

Last Version

1.3.3
Release Date

Release Date

Type

Type

jar
Description

Description

font-atlas-sdf
WebJar for font-atlas-sdf
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/dfcreative/font-atlas-sdf

Download font-atlas-sdf

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/font-atlas-sdf/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>font-atlas-sdf</artifactId>
    <version>1.3.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/font-atlas-sdf/
implementation 'org.webjars.npm:font-atlas-sdf:1.3.3'
// https://jarcasting.com/artifacts/org.webjars.npm/font-atlas-sdf/
implementation ("org.webjars.npm:font-atlas-sdf:1.3.3")
'org.webjars.npm:font-atlas-sdf:jar:1.3.3'
<dependency org="org.webjars.npm" name="font-atlas-sdf" rev="1.3.3">
  <artifact name="font-atlas-sdf" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='font-atlas-sdf', version='1.3.3')
)
libraryDependencies += "org.webjars.npm" % "font-atlas-sdf" % "1.3.3"
[org.webjars.npm/font-atlas-sdf "1.3.3"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : optical-properties jar [1.0.0,2)
org.webjars.npm : tiny-sdf jar [1.0.2,2)

Project Modules

There are no modules declared in this project.

font-atlas-sdf unstable

Populate a <canvas> element with a font texture atlas – can be used to quickly generate SDF (Signed Distance Field) fonts. SDF is the most efficient way to draw text in WebGL, see article. For bitmap fonts see font-atlas.

Demo

Usage

npm install font-atlas-sdf

canvas = fontAtlas(options?)

Populates and returns a <canvas> element with a font texture atlas. Takes the following options:

Property Default Meaning
canvas New canvas use an existing <canvas> element.
font 16px sans-serif the font family to use when drawing the text. Can be a css font string or an object with font properties: size, family, style, weight, variant, stretch.
shape [512, 512] an array containing the [width, height] for the canvas in pixels.
step [32, 32] an array containing the [width, height] for each cell in pixels.
chars [32, 126] may be one of either: a string containing all of the characters to use; an array of all the characters to use; an array specifying the [start, end] character codes to use.
radius size × 1.5 affects the "slope" of distance-transform.
align 'optical' align symbol vertically by bounding box rather than font baseline. Available values: 'optical' for center of mass alignment (see optical-properties), 'bounds' for bounding box alignment or false to use font alignment.
fit 0.5 normalize glyph sizes to cover same part of size. Can be a number or bool, eg. 0.5 covers half of size, 1 fits to the full size and false disables fit.

Font atlas texture

Related

Versions

Version
1.3.3