KiCad PCB EDA Suite
|
#include <fontconfig.h>
Public Types | |
enum class | FF_RESULT { FF_OK , FF_ERROR , FF_SUBSTITUTE , FF_MISSING_BOLD , FF_MISSING_ITAL , FF_MISSING_BOLD_ITAL } |
Public Member Functions | |
FONTCONFIG () | |
FF_RESULT | FindFont (const wxString &aFontName, wxString &aFontFile, int &aFaceIndex, bool aBold, bool aItalic) |
Given a fully-qualified font name ("Times:Bold:Italic") find the closest matching font and return its filepath in aFontFile. More... | |
void | ListFonts (std::vector< std::string > &aFonts, const std::string &aDesiredLang) |
List the current available font families. More... | |
Static Public Member Functions | |
static wxString | Version () |
Private Member Functions | |
bool | isLanguageMatch (const wxString &aSearchLang, const wxString &aSupportedLang) |
Matches the two rfc 3306 language entries, used for when searching for matching family names. More... | |
void | getAllFamilyStrings (FONTCONFIG_PAT &aPat, std::unordered_map< std::string, std::string > &aFamStringMap) |
Gets a list of all family name strings maped to lang. More... | |
std::string | getFamilyStringByLang (FONTCONFIG_PAT &APat, const wxString &aDesiredLang) |
Gets a family name based on desired language. More... | |
std::string | getFcString (FONTCONFIG_PAT &aPat, const char *aObj, int aIdx) |
Wrapper of FcPatternGetString to return a std::string. More... | |
Private Attributes | |
std::map< std::string, FONTINFO > | m_fontInfoCache |
wxString | m_fontCacheLastLang |
Definition at line 38 of file fontconfig.h.
|
strong |
Enumerator | |
---|---|
FF_OK | |
FF_ERROR | |
FF_SUBSTITUTE | |
FF_MISSING_BOLD | |
FF_MISSING_ITAL | |
FF_MISSING_BOLD_ITAL |
Definition at line 45 of file fontconfig.h.
FONTCONFIG::FONTCONFIG | ( | ) |
Definition at line 49 of file fontconfig.cpp.
FONTCONFIG::FF_RESULT FONTCONFIG::FindFont | ( | const wxString & | aFontName, |
wxString & | aFontFile, | ||
int & | aFaceIndex, | ||
bool | aBold, | ||
bool | aItalic | ||
) |
Given a fully-qualified font name ("Times:Bold:Italic") find the closest matching font and return its filepath in aFontFile.
A return value of false indicates a serious error in the font system.
Definition at line 154 of file fontconfig.cpp.
References _, FF_ERROR, FF_MISSING_BOLD, FF_MISSING_BOLD_ITAL, FF_MISSING_ITAL, FF_OK, FF_SUBSTITUTE, and getAllFamilyStrings().
|
private |
Gets a list of all family name strings maped to lang.
aPat | reference to FcPattern container |
aFamStringMap | Map to be populated with key, value pairs representing lang to family name |
Definition at line 108 of file fontconfig.cpp.
References getFcString().
Referenced by FindFont(), and getFamilyStringByLang().
|
private |
Gets a family name based on desired language.
This will fallback to english or first available string if no language matching string is found.
aPat | reference to FcPattern container |
aDesiredLang | Language to research for (RFC3066 format) |
Definition at line 131 of file fontconfig.cpp.
References From_UTF8(), getAllFamilyStrings(), and isLanguageMatch().
Referenced by ListFonts().
|
private |
Wrapper of FcPatternGetString to return a std::string.
aPat | reference to FcPattern container |
aObj | The fontconfig property object like FC_FAMILY, FC_STYLE, etc |
aIdx | The ith value associated with the property object |
Definition at line 96 of file fontconfig.cpp.
References fontconfig::FONTCONFIG_PAT::pat, and res.
Referenced by getAllFamilyStrings().
|
private |
Matches the two rfc 3306 language entries, used for when searching for matching family names.
The overall logic is simple, either both language tags matched exactly or one tag is "single" level that the other language tag contains. There's nuances to language tags beyond this but font tags will most likely never be more complex than say "zh-CN" or single tag "en".
aSearchLang | the language being searched for |
aSupportedLang | the language being offered |
Definition at line 66 of file fontconfig.cpp.
References wxStringSplit().
Referenced by getFamilyStringByLang().
void FONTCONFIG::ListFonts | ( | std::vector< std::string > & | aFonts, |
const std::string & | aDesiredLang | ||
) |
List the current available font families.
aDesiredLang | The desired language of font name to report back if available, otherwise it will fallback |
Definition at line 293 of file fontconfig.cpp.
References From_UTF8(), getFamilyStringByLang(), m_fontCacheLastLang, m_fontInfoCache, and traceFonts.
|
static |
Definition at line 43 of file fontconfig.cpp.
Referenced by KIFONT::VERSION_INFO::FontConfig().
|
private |
Definition at line 72 of file fontconfig.h.
Referenced by ListFonts().
|
private |
Definition at line 71 of file fontconfig.h.
Referenced by ListFonts().