BMFont description, parsed with Text::parse_bmfont or loaded as a BMFontAsset

This class flattens all the info and common data.

Introduced properties

fun base: Float

gamnit :: BMFont :: base

Pixels from the top of the line to the base of the characters
protected fun base=(base: Float)

gamnit :: BMFont :: base=

Pixels from the top of the line to the base of the characters
fun bold: Bool

gamnit :: BMFont :: bold

Is the font bold?
protected fun bold=(bold: Bool)

gamnit :: BMFont :: bold=

Is the font bold?
fun chars: Map[Char, BMFontChar]

gamnit :: BMFont :: chars

Characters in the font
protected fun chars=(chars: Map[Char, BMFontChar])

gamnit :: BMFont :: chars=

Characters in the font
init defaultinit(face: Text, size: Float, bold: Bool, italic: Bool, unicode: Bool, padding: String, spacing: String, line_height: Float, base: Float, scale_w: Float, scale_h: Float)

gamnit :: BMFont :: defaultinit

fun face: Text

gamnit :: BMFont :: face

Name of the source true type font
protected fun face=(face: Text)

gamnit :: BMFont :: face=

Name of the source true type font
fun italic: Bool

gamnit :: BMFont :: italic

Is the font italic?
protected fun italic=(italic: Bool)

gamnit :: BMFont :: italic=

Is the font italic?
fun kerning(prev_char: nullable Char, char: Char): Float

gamnit :: BMFont :: kerning

Additional distance between prev_char and char
fun kernings: HashMap2[Char, Char, Float]

gamnit :: BMFont :: kernings

Distance between certain characters
protected fun kernings=(kernings: HashMap2[Char, Char, Float])

gamnit :: BMFont :: kernings=

Distance between certain characters
fun line_height: Float

gamnit :: BMFont :: line_height

Distance in pixels between each line of text
protected fun line_height=(line_height: Float)

gamnit :: BMFont :: line_height=

Distance in pixels between each line of text
fun padding: String

gamnit :: BMFont :: padding

Padding for each character
protected fun padding=(padding: String)

gamnit :: BMFont :: padding=

Padding for each character
fun pages: Map[String, TextureAsset]

gamnit :: BMFont :: pages

Textures
protected fun pages=(pages: Map[String, TextureAsset])

gamnit :: BMFont :: pages=

Textures
fun scale_h: Float

gamnit :: BMFont :: scale_h

Height of the texture
protected fun scale_h=(scale_h: Float)

gamnit :: BMFont :: scale_h=

Height of the texture
fun scale_w: Float

gamnit :: BMFont :: scale_w

Width of the texture
protected fun scale_w=(scale_w: Float)

gamnit :: BMFont :: scale_w=

Width of the texture
fun size: Float

gamnit :: BMFont :: size

Size of the source true type font
protected fun size=(size: Float)

gamnit :: BMFont :: size=

Size of the source true type font
fun spacing: String

gamnit :: BMFont :: spacing

Spacing for each character
protected fun spacing=(spacing: String)

gamnit :: BMFont :: spacing=

Spacing for each character
fun unicode: Bool

gamnit :: BMFont :: unicode

Does the font uses the Unicode charset?
protected fun unicode=(unicode: Bool)

gamnit :: BMFont :: unicode=

Does the font uses the Unicode charset?

Redefined properties

redef type SELF: BMFont

gamnit $ BMFont :: SELF

Type of this instance, automatically specialized in every class
redef fun to_s: String

gamnit $ BMFont :: to_s

User readable representation of self.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun base: Float

gamnit :: BMFont :: base

Pixels from the top of the line to the base of the characters
protected fun base=(base: Float)

gamnit :: BMFont :: base=

Pixels from the top of the line to the base of the characters
fun bold: Bool

gamnit :: BMFont :: bold

Is the font bold?
protected fun bold=(bold: Bool)

gamnit :: BMFont :: bold=

Is the font bold?
fun chars: Map[Char, BMFontChar]

gamnit :: BMFont :: chars

Characters in the font
protected fun chars=(chars: Map[Char, BMFontChar])

gamnit :: BMFont :: chars=

Characters in the font
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
init defaultinit(face: Text, size: Float, bold: Bool, italic: Bool, unicode: Bool, padding: String, spacing: String, line_height: Float, base: Float, scale_w: Float, scale_h: Float)

gamnit :: BMFont :: defaultinit

fun face: Text

gamnit :: BMFont :: face

Name of the source true type font
protected fun face=(face: Text)

gamnit :: BMFont :: face=

Name of the source true type font
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun italic: Bool

gamnit :: BMFont :: italic

Is the font italic?
protected fun italic=(italic: Bool)

gamnit :: BMFont :: italic=

Is the font italic?
fun kerning(prev_char: nullable Char, char: Char): Float

gamnit :: BMFont :: kerning

Additional distance between prev_char and char
fun kernings: HashMap2[Char, Char, Float]

gamnit :: BMFont :: kernings

Distance between certain characters
protected fun kernings=(kernings: HashMap2[Char, Char, Float])

gamnit :: BMFont :: kernings=

Distance between certain characters
fun line_height: Float

gamnit :: BMFont :: line_height

Distance in pixels between each line of text
protected fun line_height=(line_height: Float)

gamnit :: BMFont :: line_height=

Distance in pixels between each line of text
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun padding: String

gamnit :: BMFont :: padding

Padding for each character
protected fun padding=(padding: String)

gamnit :: BMFont :: padding=

Padding for each character
fun pages: Map[String, TextureAsset]

gamnit :: BMFont :: pages

Textures
protected fun pages=(pages: Map[String, TextureAsset])

gamnit :: BMFont :: pages=

Textures
fun scale_h: Float

gamnit :: BMFont :: scale_h

Height of the texture
protected fun scale_h=(scale_h: Float)

gamnit :: BMFont :: scale_h=

Height of the texture
fun scale_w: Float

gamnit :: BMFont :: scale_w

Width of the texture
protected fun scale_w=(scale_w: Float)

gamnit :: BMFont :: scale_w=

Width of the texture
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun size: Float

gamnit :: BMFont :: size

Size of the source true type font
protected fun size=(size: Float)

gamnit :: BMFont :: size=

Size of the source true type font
fun spacing: String

gamnit :: BMFont :: spacing

Spacing for each character
protected fun spacing=(spacing: String)

gamnit :: BMFont :: spacing=

Spacing for each character
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun unicode: Bool

gamnit :: BMFont :: unicode

Does the font uses the Unicode charset?
protected fun unicode=(unicode: Bool)

gamnit :: BMFont :: unicode=

Does the font uses the Unicode charset?
package_diagram gamnit::BMFont BMFont core::Object Object gamnit::BMFont->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

gamnit $ BMFont
# BMFont description, parsed with `Text::parse_bmfont` or loaded as a `BMFontAsset`
#
# This class flattens all the `info` and `common` data.
class BMFont

	# ---
	# info part
	#
	# How the font was generated.

	# Name of the source true type font
	var face: Text

	# Size of the source true type font
	var size: Float

	# Is the font bold?
	var bold: Bool

	# Is the font italic?
	var italic: Bool

	# Does the font uses the Unicode charset?
	var unicode: Bool

	# Padding for each character
	#
	# In the format `up,right,down,left`
	var padding: String

	# Spacing for each character
	#
	# In the format `horizontal,vertical`.
	var spacing: String

	# ---
	# common part
	#
	# Information common to all characters

	# Distance in pixels between each line of text
	var line_height: Float

	# Pixels from the top of the line to the base of the characters
	var base: Float

	# Width of the texture
	var scale_w: Float

	# Height of the texture
	var scale_h: Float

	# Textures
	var pages = new Map[String, TextureAsset]

	# Characters in the font
	var chars = new Map[Char, BMFontChar]

	# Distance between certain characters
	var kernings = new HashMap2[Char, Char, Float]

	# Additional distance between `prev_char` and `char`
	fun kerning(prev_char: nullable Char, char: Char): Float
	do
		if prev_char == null then return 0.0
		return kernings[prev_char, char] or else 0.0
	end

	redef fun to_s do return "<{class_name} {face} at {size} pt, "+
	                         "{pages.length} pages, {chars.length} chars>"

	# TODO
	#
	# # From info
	# charset
	# stretchH
	# smooth
	# aa
	# outline
	#
	# # From common
	# packed
	# alphaChnl
	# redChnl
	# greenChnl
	# blueChnl
end
lib/gamnit/bmfont.nit:29,1--115,3