Skip to content

BitmapCell

final class BitmapCell
Package: dev.joid.lib.font.impl.bitmap · Module: core · Source: BitmapCell.java

The rectangle of a texture that holds one glyph of a bitmap font, and where that glyph sits in its line.

BitmapTextRenderer.getCell returns one per glyph. The texel coordinates pick the glyph in the texture; the bounds place it, in font pixels, from the left edge of the glyph and from the top of its ascender. Each texel is filtered by the area it covers on screen, so the glyph stays crisp at its bitmap size and smooth at other sizes.

ReturnsSignatureSummary
BitmapCellcreate(ITexture texture, int texelLeft, int texelTop, int texelRight, int texelBottom) factoryCreates the cell of the texels from texelLeft, texelTop included to texelRight, texelBottom excluded in texture; its bounds start at the size of those texels, from (0, 0).

PropertyTypeDefaultSummary
boldbooleanfalseIf true, the glyph draws twice, the second time one font pixel to the right, which thickens a font that has no bold face.
grayscalebooleanfalseIf true, the red channel of the texels is the coverage of a white glyph, tinted by the text color; if false, the texels are colors with alpha, multiplied by the text color.

ReturnsSignatureSummary
thisbounds(double left, double top, double right, double bottom) fluentSets where the glyph draws, in font pixels: left and right from the left edge of the glyph, top and bottom from the top of the ascender.
doublegetWidth()Returns the width of the bounds, in font pixels.
doublegetHeight()Returns the height of the bounds, in font pixels.
ReturnsSignatureSummary
intgetTexelWidth()Returns the width of the texel rectangle.
intgetTexelHeight()Returns the height of the texel rectangle.
intgetTexelTop()Returns the top row of the texel rectangle, included.
intgetTexelBottom()Returns the bottom row of the texel rectangle, excluded.
intgetTexelLeft()Returns the left column of the texel rectangle, included.
intgetTexelRight()Returns the right column of the texel rectangle, excluded.
ITexturegetTexture()Returns the texture that holds the glyph.
doublegetTop()Returns the top of the bounds, in font pixels from the top of the ascender.
doublegetBottom()Returns the bottom of the bounds, in font pixels from the top of the ascender.
doublegetLeft()Returns the left of the bounds, in font pixels from the left edge of the glyph.
doublegetRight()Returns the right of the bounds, in font pixels from the left edge of the glyph.

BitmapCell create(ITexture texture, int texelLeft, int texelTop, int texelRight, int texelBottom) factory

Throws:

  • IllegalArgumentException: A bitmap cell needs at least one texel, got the texels …, …, …, …: give a right above the left and a bottom above the top

Creates the cell of the texels from texelLeft, texelTop included to texelRight, texelBottom excluded in texture; its bounds start at the size of those texels, from (0, 0). Throws IllegalArgumentException when the rectangle holds no texel.

  • this bold(boolean bold) fluent
  • boolean isBold()

Default: false

If true, the glyph draws twice, the second time one font pixel to the right, which thickens a font that has no bold face.

  • this grayscale(boolean grayscale) fluent
  • boolean isGrayscale()

Default: false

If true, the red channel of the texels is the coverage of a white glyph, tinted by the text color; if false, the texels are colors with alpha, multiplied by the text color.

this bounds(double left, double top, double right, double bottom) fluent

Throws:

  • IllegalArgumentException: The bounds of a bitmap cell cannot be empty, got …, …, …, …: give a right above the left and a bottom above the top

Sets where the glyph draws, in font pixels: left and right from the left edge of the glyph, top and bottom from the top of the ascender. Bounds larger than the texels stretch them. Throws IllegalArgumentException when the bounds are empty.

double getWidth()

Returns the width of the bounds, in font pixels.

double getHeight()

Returns the height of the bounds, in font pixels.

int getTexelWidth()

Returns the width of the texel rectangle.

int getTexelHeight()

Returns the height of the texel rectangle.

int getTexelTop()

Returns the top row of the texel rectangle, included.

int getTexelBottom()

Returns the bottom row of the texel rectangle, excluded.

int getTexelLeft()

Returns the left column of the texel rectangle, included.

int getTexelRight()

Returns the right column of the texel rectangle, excluded.

ITexture getTexture()

Returns the texture that holds the glyph.

double getTop()

Returns the top of the bounds, in font pixels from the top of the ascender.

double getBottom()

Returns the bottom of the bounds, in font pixels from the top of the ascender.

double getLeft()

Returns the left of the bounds, in font pixels from the left edge of the glyph.

double getRight()

Returns the right of the bounds, in font pixels from the left edge of the glyph.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page