Package dev.cerus.maps.api.font
Class MapFont
java.lang.Object
dev.cerus.maps.api.font.MapFont
Represents a font
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MapFont
fromBukkit(org.bukkit.map.MapFont bukkitFont)
Convert Bukkit font to maps fontget(int codePoint)
Get a registered spriteint
Get the maximum height of this fontint
Get the height for a stringgetSprites(String text)
Get all sprites for the specified textint
Get the width of a stringboolean
isValid(char c)
Checks if a character was registeredboolean
isValid(int codePoint)
Checks if a codepoint was registeredboolean
Checks if a string is validvoid
Register a codepoint
-
Field Details
-
MINECRAFT_FONT
-
-
Constructor Details
-
MapFont
public MapFont()
-
-
Method Details
-
fromBukkit
Convert Bukkit font to maps font- Parameters:
bukkitFont
- The Bukkit font- Returns:
- The converted font
-
set
Register a codepoint- Parameters:
codePoint
- The codepointsprite
- The sprite
-
get
Get a registered sprite- Parameters:
codePoint
- The codepoint registered to the sprite- Returns:
- The sprite
- Throws:
IllegalArgumentException
- if the codepoint was not registered
-
getSprites
Get all sprites for the specified text- Parameters:
text
- The text- Returns:
- A list of sprites
- Throws:
IllegalArgumentException
- if the text is invalid
-
getWidth
Get the width of a string- Parameters:
text
- The string- Returns:
- The width of the string
- Throws:
IllegalArgumentException
- if the text is invalid
-
getHeight
public int getHeight()Get the maximum height of this font- Returns:
- The max height
-
getHeight
Get the height for a string- Parameters:
text
- The string- Returns:
- The height of the string
- Throws:
IllegalArgumentException
- if the text is invalid
-
isValid
public boolean isValid(int codePoint)Checks if a codepoint was registered- Parameters:
codePoint
- The codepoint- Returns:
- True if valid
-
isValid
public boolean isValid(char c)Checks if a character was registered- Parameters:
c
- The character- Returns:
- True if valid
-
isValid
Checks if a string is valid- Parameters:
text
- The string- Returns:
- True if valid
-