本文整理汇总了C++中FcConfigGetCurrent函数的典型用法代码示例。如果您正苦于以下问题:C++ FcConfigGetCurrent函数的具体用法?C++ FcConfigGetCurrent怎么用?C++ FcConfigGetCurrent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FcConfigGetCurrent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_file_monitors
static void
create_file_monitors (FontViewModel *self)
{
FcConfig *config;
FcStrList *str_list;
FcChar8 *path;
GFile *file;
GFileMonitor *monitor;
config = FcConfigGetCurrent ();
str_list = FcConfigGetFontDirs (config);
while ((path = FcStrListNext (str_list)) != NULL) {
file = g_file_new_for_path ((const gchar *) path);
monitor = g_file_monitor (file, G_FILE_MONITOR_NONE,
NULL, NULL);
if (monitor != NULL) {
self->priv->monitors = g_list_prepend (self->priv->monitors, monitor);
g_signal_connect (monitor, "changed",
G_CALLBACK (file_monitor_changed_cb), self);
}
g_object_unref (file);
}
FcStrListDone (str_list);
}
示例2: cairo_version_string
void manager::init() const
{
LOG_FT << "Cairo version: " << cairo_version_string() << std::endl;
LOG_FT << "Pango version: " << pango_version_string() << std::endl;
#ifdef CAIRO_HAS_FT_FONT
if (!FcConfigAppFontAddDir(FcConfigGetCurrent(),
reinterpret_cast<const FcChar8 *>((game_config::path + "/fonts").c_str())))
{
ERR_FT << "Could not load the true type fonts" << std::endl;
throw error();
}
#endif
#if CAIRO_HAS_WIN32_FONT
BOOST_FOREACH(const std::string& path, filesystem::get_binary_paths("fonts")) {
std::vector<std::string> files;
if(filesystem::is_directory(path))
filesystem::get_files_in_dir(path, &files, NULL, filesystem::ENTIRE_FILE_PATH);
BOOST_FOREACH(const std::string& file, files) {
if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
{
utf16::string ufile = unicode_cast<utf16::string>(file);
std::wstring wfile(ufile.begin(), ufile.end());
AddFontResourceW(wfile.c_str());
}
}
}
#endif
}
示例3: fprintf
void
XeTeXFontMgr_FC::initialize()
{
if (FcInit() == FcFalse) {
fprintf(stderr, "fontconfig initialization failed!\n");
exit(9);
}
if (gFreeTypeLibrary == 0 && FT_Init_FreeType(&gFreeTypeLibrary) != 0) {
fprintf(stderr, "FreeType initialization failed!\n");
exit(9);
}
UErrorCode err = U_ZERO_ERROR;
macRomanConv = ucnv_open("macintosh", &err);
utf16beConv = ucnv_open("UTF16BE", &err);
utf8Conv = ucnv_open("UTF8", &err);
if (err != 0) {
fprintf(stderr, "internal error; cannot read font names\n");
exit(3);
}
FcPattern* pat = FcNameParse((const FcChar8*)":outline=true");
FcObjectSet* os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, FC_FILE, FC_INDEX,
FC_FULLNAME, FC_WEIGHT, FC_WIDTH, FC_SLANT, NULL);
allFonts = FcFontList(FcConfigGetCurrent(), pat, os);
FcObjectSetDestroy(os);
FcPatternDestroy(pat);
cachedAll = false;
}
示例4: FcConfigUptoDate
FcBool
FcConfigUptoDate (FcConfig *config)
{
FcFileTime config_time, config_dir_time, font_time;
time_t now = time(0);
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return FcFalse;
}
config_time = FcConfigNewestFile (config->configFiles);
config_dir_time = FcConfigNewestFile (config->configDirs);
font_time = FcConfigNewestFile (config->fontDirs);
if ((config_time.set && config_time.time - config->rescanTime > 0) ||
(config_dir_time.set && (config_dir_time.time - config->rescanTime) > 0) ||
(font_time.set && (font_time.time - config->rescanTime) > 0))
{
/* We need to check for potential clock problems here (OLPC ticket #6046) */
if ((config_time.set && (config_time.time - now) > 0) ||
(config_dir_time.set && (config_dir_time.time - now) > 0) ||
(font_time.set && (font_time.time - now) > 0))
{
fprintf (stderr,
"Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected.\n");
config->rescanTime = now;
return FcTrue;
}
else
return FcFalse;
}
config->rescanTime = now;
return FcTrue;
}
示例5: sui_font_fromfc
bool sui_font_fromfc(sui_font *font, sui_library *l, char **error, FcPattern *pattern)
{
FcResult res;
FcConfig *config = FcConfigGetCurrent();
if (!FcConfigSubstitute(config, pattern, FcMatchFont)) {
*error = sui_aprintf("FcConfigSubstitute: Allocation failure");
return false;
}
FcDefaultSubstitute(pattern);
FcPattern *match = FcFontMatch(config, pattern, &res);
if (res != FcResultMatch) {
*error = sui_aprintf("FcFontMatch: %s", sui_result_name(res));
return false;
}
FcChar8 *file;
int index;
res = FcPatternGetString(match, FC_FILE, 0, &file);
if (res != FcResultMatch) {
*error = sui_aprintf("FcPatternGetString FC_FILE: %s", sui_result_name(res));
return false;
}
res = FcPatternGetInteger(match, FC_INDEX, 0, &index);
if (res != FcResultMatch) {
*error = sui_aprintf("FcPatternGetInteger FC_INDEX: %s", sui_result_name(res));
return false;
}
FT_Error fterr;
if ((fterr = FT_New_Face(l->library, (const char*)file, index, &font->face))) {
*error = sui_aprintf("FT_New_Face: Error code %i", fterr);
return false;
}
return font_fromfont(font, l, error, font->face);
}
示例6: FcConfigBuildFonts
FcBool
FcConfigBuildFonts (FcConfig *config)
{
FcFontSet *fonts;
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return FcFalse;
}
fonts = FcFontSetCreate ();
if (!fonts)
return FcFalse;
FcConfigSetFonts (config, fonts, FcSetSystem);
if (!FcConfigAddDirList (config, FcSetSystem, config->fontDirs)) {
if(FcDebug ())
fprintf(stderr,"Failed to get list of available fonts.");
return FcFalse;
}
//if (FcDebug () & FC_DBG_FONTSET)
#ifdef DEBUG
FcFontSetPrint (fonts);
#endif
return FcTrue;
}
示例7: FcLoadConfig
gboolean
FcLoadConfig(const gchar * filepath)
{
g_assert(FcInit());
gboolean result = FcConfigParseAndLoad(FcConfigGetCurrent(), (FcChar8 *) filepath, FALSE);
return result;
}
示例8: FcFileScan
FcBool
FcFileScan (FcFontSet *set,
FcStrSet *dirs,
FcFileCache *cache, /* XXX unused */
FcBlanks *blanks,
const FcChar8 *file,
FcBool force)
{
return FcFileScanConfig (set, dirs, blanks, file, FcConfigGetCurrent ());
}
示例9: FcConfigGetCacheDirs
FcStrList *
FcConfigGetCacheDirs (const FcConfig *config)
{
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
return FcStrListCreate (config->cacheDirs);
}
示例10: shoes_font_list
VALUE
shoes_font_list()
{
VALUE ary = rb_ary_new();
FcConfig *fc = FcConfigGetCurrent();
FcFontSet *fonts = FcConfigGetFonts(fc, FcSetApplication);
if (fonts) shoes_make_font_list(fonts, ary);
fonts = FcConfigGetFonts(fc, FcSetSystem);
if (fonts) shoes_make_font_list(fonts, ary);
return ary;
}
示例11: FcConfigGetConfigFiles
FcStrList *
FcConfigGetConfigFiles (FcConfig *config)
{
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
return FcStrListCreate (config->configFiles);
}
示例12: FcConfigGetRescanInterval
int
FcConfigGetRescanInterval (FcConfig *config)
{
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
return config->rescanInterval;
}
示例13: FcConfigGetBlanks
FcBlanks *
FcConfigGetBlanks (FcConfig *config)
{
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
return config->blanks;
}
示例14: FcConfigGetFontDirs
FcStrList *
FcConfigGetFontDirs (FcConfig *config)
{
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
return FcStrListCreate (config->fontDirs);
}
示例15: error
manager::manager()
{
#ifdef CAIRO_HAS_FT_FONT
std::string font_path = game_config::path + "/fonts";
if (!FcConfigAppFontAddDir(FcConfigGetCurrent(),
reinterpret_cast<const FcChar8 *>(font_path.c_str())))
{
ERR_FT << "Could not load the true type fonts" << std::endl;
throw font::error("font config lib failed to add the font path: '" + font_path + "'");
}
std::string font_file = font_path + "/fonts.conf";
if(!FcConfigParseAndLoad(FcConfigGetCurrent(),
reinterpret_cast<const FcChar8*>(font_file.c_str()),
FcFalse))
{
ERR_FT << "Could not load local font configuration\n";
throw font::error("font config lib failed to find font.conf: '" + font_file + "'");
}
else
{
LOG_FT << "Local font configuration loaded\n";
}
#endif
#if CAIRO_HAS_WIN32_FONT
for(const std::string& path : filesystem::get_binary_paths("fonts")) {
std::vector<std::string> files;
if(filesystem::is_directory(path)) {
filesystem::get_files_in_dir(path, &files, nullptr, filesystem::ENTIRE_FILE_PATH);
}
for(const std::string& file : files) {
if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
{
const std::wstring wfile = unicode_cast<std::wstring>(file);
AddFontResourceExW(wfile.c_str(), FR_PRIVATE, nullptr);
}
}
}
#endif
}