Package org.geotools.renderer.style
Class FontCache
Object
FontCache
Lookup and caches font definitions for faster retrieval
- Author:
- Andrea Aime - TOPP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlternatives
(String name) Given a font name, returns alternatives for other scripts, based on the assumption they start with the same base name, e.g., "Noto Sans" also has a number of alternative fonts dedicated to specific scripts, like "Noti Sans Urdu", "Noto Sans Arabic", "Noto Sans Javanese" and so on.Returns the set of font families and font faces available in the system and those manually loaded into the cachestatic FontCache
Returns the default, system wide font cachestatic Font
loadFromUrl
(String fontUrl) Tries to load the specified font name as a URL.void
registerFont
(Font f) Adds the specified font in the font cache.void
Resets the font loading cache.
-
Constructor Details
-
FontCache
public FontCache()
-
-
Method Details
-
getDefaultInstance
Returns the default, system wide font cache- Since:
- 2.6
-
getFont
-
loadFromUrl
Tries to load the specified font name as a URL. Does not cache the result. -
registerFont
Adds the specified font in the font cache. Useful if you want to load fonts that are not installed in the Operating System and cannot provide a full path to fonts either. -
resetCache
public void resetCache()Resets the font loading cache. If any font was manually registered, it will have to be registered again -
getAvailableFonts
Returns the set of font families and font faces available in the system and those manually loaded into the cache -
getAlternatives
Given a font name, returns alternatives for other scripts, based on the assumption they start with the same base name, e.g., "Noto Sans" also has a number of alternative fonts dedicated to specific scripts, like "Noti Sans Urdu", "Noto Sans Arabic", "Noto Sans Javanese" and so on. The code will not return style alterations like "Noto Sans Bold" or "Noto Sans Bold Italic" thought (strips all font names containing "bold" and "italic", case insesitive).- Returns:
- A list of font names with the same base name
-