Package com.github.tommyettinger.textra
Class Font.GlyphRegion
java.lang.Object
com.badlogic.gdx.graphics.g2d.TextureRegion
com.github.tommyettinger.textra.Font.GlyphRegion
- Enclosing class:
- Font
public static class Font.GlyphRegion
extends com.badlogic.gdx.graphics.g2d.TextureRegion
Describes the region of a glyph in a larger TextureRegion, carrying a little more info about the offsets that
apply to where the glyph is rendered.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloatThe offset from the left of the original image to the left of the packed image, after whitespace was removed for packing.floatThe offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing.floatHow far to move the "cursor" to the right after drawing this GlyphRegion. -
Constructor Summary
ConstructorsConstructorDescriptionGlyphRegion(com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, int x, int y, int width, int height)Creates a GlyphRegion from a parent TextureRegion (typically from an atlas), along with the lower-left x and y coordinates, the width, and the height of the GlyphRegion.GlyphRegion(Font.GlyphRegion other)Copies another GlyphRegion. -
Method Summary
Modifier and TypeMethodDescriptionvoidflip(boolean x, boolean y)Flips the region, adjusting the offset so the image appears to be flipped as if no whitespace has been removed for packing.Methods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion
getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, scroll, setRegion, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, setU, setU2, setV, setV2, split, split
-
Field Details
-
offsetX
public float offsetXThe offset from the left of the original image to the left of the packed image, after whitespace was removed for packing. -
offsetY
public float offsetYThe offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing. -
xAdvance
public float xAdvanceHow far to move the "cursor" to the right after drawing this GlyphRegion. Uses the same unit asoffsetX.
-
-
Constructor Details
-
GlyphRegion
public GlyphRegion(com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, int x, int y, int width, int height)Creates a GlyphRegion from a parent TextureRegion (typically from an atlas), along with the lower-left x and y coordinates, the width, and the height of the GlyphRegion.- Parameters:
textureRegion- a TextureRegion, typically from a TextureAtlasx- the x-coordinate of the left side of the texture, in pixelsy- the y-coordinate of the lower side of the texture, in pixelswidth- the width of the GlyphRegion, in pixelsheight- the height of the GlyphRegion, in pixels
-
GlyphRegion
Copies another GlyphRegion.- Parameters:
other- the other GlyphRegion to copy
-
-
Method Details
-
flip
public void flip(boolean x, boolean y)Flips the region, adjusting the offset so the image appears to be flipped as if no whitespace has been removed for packing.- Overrides:
flipin classcom.badlogic.gdx.graphics.g2d.TextureRegion- Parameters:
x- true if this should flip x to be -xy- true if this should flip y to be -y
-