31 static const char*
pathsToSearch[] = {
"/etc/fonts/fonts.conf",
32 "/usr/share/fonts/fonts.conf",
33 "/usr/local/etc/fonts/fonts.conf",
34 "/usr/share/defaults/fonts/fonts.conf" };
43StringArray FTTypefaceList::getDefaultFontDirectories()
47 fontDirs.addTokens (String (CharPointer_UTF8 (getenv (
"JUCE_FONT_PATH"))),
";,",
"");
54 for (
auto* e :
fontsInfo->getChildWithTagNameIterator (
"dir"))
56 auto fontPath = e->getAllSubText().trim();
60 if (e->getStringAttribute (
"prefix") ==
"xdg")
77 fontDirs.add (
"/usr/X11R6/lib/X11/fonts");
100 return FTTypefaceList::getInstance()->findAllFamilyNames();
105 return FTTypefaceList::getInstance()->findAllTypefaceStyles (family);
117 : defaultSans (getDefaultSansSerifFontName()),
118 defaultSerif (getDefaultSerifFontName()),
119 defaultFixed (getDefaultMonospacedFontName())
132 String defaultSans, defaultSerif, defaultFixed;
135 template <
typename Range>
143 for (
auto& name : names)
144 if (name.startsWithIgnoreCase (
choice))
148 for (
auto& name : names)
149 if (name.containsIgnoreCase (
choice))
155 static String getDefaultSansSerifFontName()
158 FTTypefaceList::getInstance()->getSansSerifNames (
allFonts);
160 static constexpr const char* targets[] {
"Verdana",
161 "Bitstream Vera Sans",
166 return pickBestFont (
allFonts, targets);
169 static String getDefaultSerifFontName()
172 FTTypefaceList::getInstance()->getSerifNames (
allFonts);
174 static constexpr const char* targets[] {
"Bitstream Vera Serif",
180 return pickBestFont (
allFonts, targets);
183 static String getDefaultMonospacedFontName()
186 FTTypefaceList::getInstance()->getMonospacedNames (
allFonts);
188 static constexpr const char* targets[] {
"DejaVu Sans Mono",
189 "Bitstream Vera Sans Mono",
195 return pickBestFont (
allFonts, targets);
A text string with a set of colour/font settings that are associated with sub-ranges of the text.
Represents a local file or directory.
const String & getFullPathName() const noexcept
Returns the complete, absolute path of this file.
Represents a particular font, including its size, style, etc.
static Typeface::Ptr getDefaultTypefaceForFont(const Font &font)
Returns the default system typeface for the given font.
static const String & getDefaultSansSerifFontName()
Returns a typeface font family that represents the default sans-serif font.
String getTypefaceName() const noexcept
Returns the font family of the typeface that this font uses.
static const String & getDefaultMonospacedFontName()
Returns a typeface font family that represents the default monospaced font.
String getTypefaceStyle() const noexcept
Returns the font style of the typeface that this font uses.
static StringArray findAllTypefaceStyles(const String &family)
Returns a list of all the available typeface font styles.
void setTypefaceStyle(const String &newStyle)
Changes the font style of the typeface.
void setTypefaceName(const String &faceName)
Changes the font family of the typeface.
static StringArray findAllTypefaceNames()
Returns a list of all the available typeface font families.
static const String & getDefaultSerifFontName()
Returns a typeface font family that represents the default serif font.
A general-purpose range object, that simply represents any linear range with a start and end point.
A special array for holding a list of strings.
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
Searches for a string in the array.
static String getEnvironmentVariable(const String &name, const String &defaultValue)
Returns an environment variable.
static void scanFolderForFonts(const File &folder)
On some platforms, this allows a specific path to be scanned.
static Ptr createSystemTypefaceFor(const Font &font)
Creates a new system typeface.
std::unique_ptr< XmlElement > parseXML(const String &textToParse)
Attempts to parse some XML text, returning a new XmlElement if it was valid.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...