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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
BitmapCell | create(ITexture texture, int texelLeft, int texelTop, int texelRight, int texelBottom) factory | 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). |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| bold | boolean | 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. |
| grayscale | boolean | 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. |
Methods
Section titled “Methods”Position and size
Section titled “Position and size”| Returns | Signature | Summary |
|---|---|---|
this | bounds(double left, double top, double right, double bottom) fluent | 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. |
double | getWidth() | Returns the width of the bounds, in font pixels. |
double | getHeight() | Returns the height of the bounds, in font pixels. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
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. |
Creation details
Section titled “Creation details”create
Section titled “create”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.
Property details
Section titled “Property details”this bold(boolean bold)fluentboolean 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.
grayscale
Section titled “grayscale”this grayscale(boolean grayscale)fluentboolean 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.
Method details
Section titled “Method details”bounds
Section titled “bounds”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.
getWidth
Section titled “getWidth”double getWidth()
Returns the width of the bounds, in font pixels.
getHeight
Section titled “getHeight”double getHeight()
Returns the height of the bounds, in font pixels.
getTexelWidth
Section titled “getTexelWidth”int getTexelWidth()
Returns the width of the texel rectangle.
getTexelHeight
Section titled “getTexelHeight”int getTexelHeight()
Returns the height of the texel rectangle.
getTexelTop
Section titled “getTexelTop”int getTexelTop()
Returns the top row of the texel rectangle, included.
getTexelBottom
Section titled “getTexelBottom”int getTexelBottom()
Returns the bottom row of the texel rectangle, excluded.
getTexelLeft
Section titled “getTexelLeft”int getTexelLeft()
Returns the left column of the texel rectangle, included.
getTexelRight
Section titled “getTexelRight”int getTexelRight()
Returns the right column of the texel rectangle, excluded.
getTexture
Section titled “getTexture”ITexture getTexture()
Returns the texture that holds the glyph.
getTop
Section titled “getTop”double getTop()
Returns the top of the bounds, in font pixels from the top of the ascender.
getBottom
Section titled “getBottom”double getBottom()
Returns the bottom of the bounds, in font pixels from the top of the ascender.
getLeft
Section titled “getLeft”double getLeft()
Returns the left of the bounds, in font pixels from the left edge of the glyph.
getRight
Section titled “getRight”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
