Package dev.cerus.maps.api.font
Class MapFont
java.lang.Object
dev.cerus.maps.api.font.MapFont
Represents a font
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MapFontfromBukkit(org.bukkit.map.MapFont bukkitFont)Convert Bukkit font to maps fontget(int codePoint)Get a registered spriteintGet the maximum height of this fontintGet the height for a stringgetSprites(String text)Get all sprites for the specified textintGet the width of a stringbooleanisValid(char c)Checks if a character was registeredbooleanisValid(int codePoint)Checks if a codepoint was registeredbooleanChecks if a string is validvoidRegister 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
-