kuzminadya/mogeefont/1.0.4

NOTE: this package is not compatible with Elm 0.19.1

MogeeFont

This module exports a font that may be rendered with WebGL. Check the example.

type alias Letter =
{ width : Float
, height : Float
, textureX : Float
, textureY : Float
, x : Float
, y : Float
}

Specifies information about the letter:

  • width, height - dimensions on the texture
  • textureX, textureY - offset on the texture
  • x, y - coordinates in the printed text
text : (Letter -> List a -> List a) -> String -> List a

A function to print the text, that takes:

  • addLetter - function to append each letter
  • string - text to be printed

addLetter can for example append two triangles for each letter, to construct a WebGL mesh

fontSrc : String

A base64 encoded black and white texture of the font in the data uri format. Can be loaded just as any remote url with Texture.load.