Package me.croabeast.takion.character
Interface CharacterInfo
- All Known Implementing Classes:
DefaultCharacter,SmallCaps
public interface CharacterInfo
Represents information about a character including its visual width.
This interface provides methods to retrieve the character itself and its associated length (which might be used for formatting or layout purposes).
Additionally, it offers a method to calculate the "bold" length, which takes into account an extra width for non-space characters.-
Method Summary
Modifier and TypeMethodDescriptiondefault intCalculates the bold length of the character.charRetrieves the character represented by this instance.intRetrieves the base length associated with this character.static CharacterInfoof(char c, int i) Creates a newCharacterInfoinstance with the specified character and length.
-
Method Details
-
getCharacter
char getCharacter()Retrieves the character represented by this instance.- Returns:
- the character
-
getLength
int getLength()Retrieves the base length associated with this character.The length can be interpreted as the visual or logical width of the character.
- Returns:
- the length of the character
-
getBoldLength
default int getBoldLength()Calculates the bold length of the character.This is computed as the base length plus an extra unit of length for non-space characters. For space characters, the bold length is equal to the base length.
- Returns:
- the bold length of the character
-
of
Creates a newCharacterInfoinstance with the specified character and length.This factory method provides a convenient way to obtain a
CharacterInfoimplementation without needing to explicitly create a new class.- Parameters:
c- the characteri- the base length of the character- Returns:
- a new
CharacterInfoinstance
-