当前位置: 首页>>代码示例>>C++>>正文


C++ FcConfigGetCurrent函数代码示例

本文整理汇总了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);
}
开发者ID:rkmax,项目名称:gnome-font-viewer,代码行数:28,代码来源:font-model.c

示例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
}
开发者ID:dailin,项目名称:wesnoth,代码行数:30,代码来源:font.cpp

示例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;
}
开发者ID:luigiScarso,项目名称:mflua,代码行数:31,代码来源:XeTeXFontMgr_FC.cpp

示例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;
}
开发者ID:Adenilson,项目名称:libfontconfig,代码行数:34,代码来源:fccfg.c

示例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);
}
开发者ID:tiffany352,项目名称:sui,代码行数:33,代码来源:renderer.c

示例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;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:27,代码来源:fccfg.c

示例7: FcLoadConfig

gboolean
FcLoadConfig(const gchar * filepath)
{
    g_assert(FcInit());
    gboolean result = FcConfigParseAndLoad(FcConfigGetCurrent(), (FcChar8 *) filepath, FALSE);
    return result;
}
开发者ID:Heether,项目名称:font-manager,代码行数:7,代码来源:_Glue_.c

示例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 ());
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-fontconfig,代码行数:10,代码来源:fcdir.c

示例9: FcConfigGetCacheDirs

FcStrList *
FcConfigGetCacheDirs (const FcConfig *config)
{
    if (!config)
    {
	config = FcConfigGetCurrent ();
	if (!config)
	    return 0;
    }
    return FcStrListCreate (config->cacheDirs);
}
开发者ID:Adenilson,项目名称:libfontconfig,代码行数:11,代码来源:fccfg.c

示例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;
}
开发者ID:whymirror,项目名称:shoes,代码行数:11,代码来源:gtk.c

示例11: FcConfigGetConfigFiles

FcStrList *
FcConfigGetConfigFiles (FcConfig    *config)
{
    if (!config)
    {
	config = FcConfigGetCurrent ();
	if (!config)
	    return 0;
    }
    return FcStrListCreate (config->configFiles);
}
开发者ID:Adenilson,项目名称:libfontconfig,代码行数:11,代码来源:fccfg.c

示例12: FcConfigGetRescanInterval

int
FcConfigGetRescanInterval (FcConfig *config)
{
    if (!config)
    {
	config = FcConfigGetCurrent ();
	if (!config)
	    return 0;
    }
    return config->rescanInterval;
}
开发者ID:Fur1ok,项目名称:fontconfig,代码行数:11,代码来源:fccfg.c

示例13: FcConfigGetBlanks

FcBlanks *
FcConfigGetBlanks (FcConfig	*config)
{
    if (!config)
    {
	config = FcConfigGetCurrent ();
	if (!config)
	    return 0;
    }
    return config->blanks;
}
开发者ID:Fur1ok,项目名称:fontconfig,代码行数:11,代码来源:fccfg.c

示例14: FcConfigGetFontDirs

FcStrList *
FcConfigGetFontDirs (FcConfig	*config)
{
    if (!config)
    {
	config = FcConfigGetCurrent ();
	if (!config)
	    return 0;
    }
    return FcStrListCreate (config->fontDirs);
}
开发者ID:Adenilson,项目名称:libfontconfig,代码行数:11,代码来源:fccfg.c

示例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
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:41,代码来源:font_config.cpp


注:本文中的FcConfigGetCurrent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。