Class Glyph
Strike
.
GlyphID is represented as an int value. For TrueType/OpenType fonts, glyph ID (or glyph index) is a 16-bit unsigned int. For composite fonts (mapping a logical font to a set of physical fonts) in JDK, the slot index is stored in the higher 8 bits, then the 16-24 bits is reserved.
Another form of GlyphID is PackedGlyphID, which is also represented by an int value. It stores sub-pixel information based on the GlyphID. We use bit 22 and bit 23 to represent the sub-pixel X positions of glyph rendering at 0.0, 0.25, 0.5, and 0.75 in the horizontal direction.
If sub-pixel positioning is not required, then GlyphID and PackedGlyphID are interchangeable.
- 0-16 bits: glyph index
- 16-22 bits: reserved
- 22-24 bits: sub-pixel X position
- 24-32 bits: slot index
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Action for methods.static final int
static final int
Text rendering methods, values are used as bit shift to obtain action.static final int
Text rendering methods, values are used as bit shift to obtain action.static final int
Action for methods.static final int
static final int
static final int
static final int
Text rendering methods, values are used as bit shift to obtain action.static final int
Text rendering methods, values are used as bit shift to obtain action.static final int
Action for methods.static final int
Text rendering methods, values are used as bit shift to obtain action.static final int
static final int
static final int
static final int
static final int
Text rendering methods, values are used as bit shift to obtain action.static final int
Action for methods. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
actionFor
(int actionType) Returns the action result for the given text rendering method.void
Returns the bounding box for this glyph, it holds rounded integer values.void
Returns the bounding box for this glyph.int
static int
getGlyphID
(int packedID) int
long
int
int
getLeft()
The bearing X.byte
int
Returns the largest dimension ( max(width, height) ).int
getPath()
int
float
getSubX()
static float
getSubX
(int packedID) int
getTop()
The bearing Y.int
getWidth()
boolean
boolean
isColor()
boolean
isEmpty()
static int
packGlyphID
(int glyphID, float xPos, int mask) boolean
setImage
(ScalerContext scalerContext) boolean
boolean
boolean
setPath
(ScalerContext scalerContext) boolean
-
Field Details
-
kSubPixelPosLen
public static final int kSubPixelPosLen- See Also:
-
kSubPixelPosMask
public static final int kSubPixelPosMask- See Also:
-
kSubPixelXShift
public static final int kSubPixelXShift- See Also:
-
kSubPixelXMask
public static final int kSubPixelXMask- See Also:
-
kUnset_Action
public static final int kUnset_ActionAction for methods.- See Also:
-
kAccept_Action
public static final int kAccept_ActionAction for methods.- See Also:
-
kReject_Action
public static final int kReject_ActionAction for methods.- See Also:
-
kDrop_Action
public static final int kDrop_ActionAction for methods.- See Also:
-
kDirectMask
public static final int kDirectMaskText rendering methods, values are used as bit shift to obtain action.- See Also:
-
kTransformedMask
public static final int kTransformedMaskText rendering methods, values are used as bit shift to obtain action.- See Also:
-
kPath
public static final int kPathText rendering methods, values are used as bit shift to obtain action.- See Also:
-
kDrawable
public static final int kDrawableText rendering methods, values are used as bit shift to obtain action.- See Also:
-
kSDF
public static final int kSDFText rendering methods, values are used as bit shift to obtain action.- See Also:
-
kMSDF
public static final int kMSDFText rendering methods, values are used as bit shift to obtain action.- See Also:
-
kBilerpGlyphBorder
public static final int kBilerpGlyphBorder- See Also:
-
kMaxAtlasDimension
public static final int kMaxAtlasDimension- See Also:
-
kMaxBilerpAtlasDimension
public static final int kMaxBilerpAtlasDimension- See Also:
-
kMaxTextSizeForMask
public static final int kMaxTextSizeForMask- See Also:
-
-
Constructor Details
-
Glyph
public Glyph(int id)
-
-
Method Details
-
packGlyphID
public static int packGlyphID(int glyphID, float xPos, int mask) -
getGlyphID
public static int getGlyphID(int packedID) -
getSubX
public static float getSubX(int packedID) -
getGlyphID
public int getGlyphID() -
getPackedID
public int getPackedID() -
getSubX
public float getSubX() -
getLeft
public int getLeft()The bearing X. -
getTop
public int getTop()The bearing Y. -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getMaxDimension
public int getMaxDimension()Returns the largest dimension ( max(width, height) ). -
getBounds
Returns the bounding box for this glyph.This may an exact bounding box or just a bounds of all control points, also known as pixel bounds.
-
getBounds
Returns the bounding box for this glyph, it holds rounded integer values.This may an exact bounding box or just a bounds of all control points, also known as pixel bounds.
-
isEmpty
public boolean isEmpty() -
getMaskFormat
public byte getMaskFormat() -
isColor
public boolean isColor() -
imageIsTooLarge
public boolean imageIsTooLarge() -
setImage
-
setImageHasBeenCalled
public boolean setImageHasBeenCalled() -
getImageBase
-
getImageAddress
public long getImageAddress() -
getRowBytes
public int getRowBytes() -
getImageSize
public int getImageSize() -
setPath
-
setPath
-
setPathHasBeenCalled
public boolean setPathHasBeenCalled() -
getPath
-
actionFor
public int actionFor(int actionType) Returns the action result for the given text rendering method.- Parameters:
actionType
- e.g.kDirectMask
-