本文整理汇总了C++中FcFontSetDestroy函数的典型用法代码示例。如果您正苦于以下问题:C++ FcFontSetDestroy函数的具体用法?C++ FcFontSetDestroy怎么用?C++ FcFontSetDestroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FcFontSetDestroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FcConfigSetFonts
void
FcConfigSetFonts (FcConfig *config,
FcFontSet *fonts,
FcSetName set)
{
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
config->fonts[set] = fonts;
}
示例2: cc_common_language_has_font
gboolean
cc_common_language_has_font (const gchar *locale)
{
const FcCharSet *charset;
FcPattern *pattern;
FcObjectSet *object_set;
FcFontSet *font_set;
gchar *language_code;
gboolean is_displayable;
is_displayable = FALSE;
pattern = NULL;
object_set = NULL;
font_set = NULL;
if (!gdm_parse_language_name (locale, &language_code, NULL, NULL, NULL))
return FALSE;
charset = FcLangGetCharSet ((FcChar8 *) language_code);
if (!charset) {
/* fontconfig does not know about this language */
is_displayable = TRUE;
}
else {
/* see if any fonts support rendering it */
pattern = FcPatternBuild (NULL, FC_LANG, FcTypeString, language_code, NULL);
if (pattern == NULL)
goto done;
object_set = FcObjectSetCreate ();
if (object_set == NULL)
goto done;
font_set = FcFontList (NULL, pattern, object_set);
if (font_set == NULL)
goto done;
is_displayable = (font_set->nfont > 0);
}
done:
if (font_set != NULL)
FcFontSetDestroy (font_set);
if (object_set != NULL)
FcObjectSetDestroy (object_set);
if (pattern != NULL)
FcPatternDestroy (pattern);
g_free (language_code);
return is_displayable;
}
示例3: FcConfigDestroy
void
FcConfigDestroy (FcConfig *config)
{
FcSetName set;
FcExprPage *page;
if (--config->ref > 0)
return;
if (config == _fcConfig)
_fcConfig = 0;
FcStrSetDestroy (config->configDirs);
FcStrSetDestroy (config->fontDirs);
FcStrSetDestroy (config->cacheDirs);
FcStrSetDestroy (config->configFiles);
FcStrSetDestroy (config->acceptGlobs);
FcStrSetDestroy (config->rejectGlobs);
FcFontSetDestroy (config->acceptPatterns);
FcFontSetDestroy (config->rejectPatterns);
if (config->blanks)
FcBlanksDestroy (config->blanks);
FcSubstDestroy (config->substPattern);
FcSubstDestroy (config->substFont);
FcSubstDestroy (config->substScan);
for (set = FcSetSystem; set <= FcSetApplication; set++)
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
page = config->expr_pool;
while (page)
{
FcExprPage *next = page->next_page;
FcMemFree (FC_MEM_EXPR, sizeof (FcExprPage));
free (page);
page = next;
}
free (config);
FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
}
示例4: FcFontSetDestroy
FontPlatformData::~FontPlatformData()
{
if (m_fallbacks) {
FcFontSetDestroy(m_fallbacks);
m_fallbacks = 0;
}
if (m_scaledFont && m_scaledFont != hashTableDeletedFontValue())
cairo_scaled_font_destroy(m_scaledFont);
}
示例5: fontconf
int fontconf()
{
FcFontSet* fs = NULL;
FcPattern* pat = NULL;
FcObjectSet* os = NULL;
FcChar8* strpat = (FcChar8*) ":lang=ja";
pat = FcNameParse(strpat);
os = FcObjectSetBuild(FC_FAMILY, FC_CHARSET, FC_FILE, (char *) 0);
fs = FcFontList(0, pat, os);
if (os)
FcObjectSetDestroy(os);
os = NULL;
FcPatternDestroy(pat);
pat = NULL;
if (!fs || fs->nfont <= 0)
goto nofont;
FcChar8 *family;
FcChar8 *file;
FcCharSet* cs;
FcChar32 ch;
FcUtf8ToUcs4((FcChar8*) "��", &ch, 3);
int i;
for (i = 0; i < fs->nfont; i++)
{
if (FcPatternGetCharSet(fs->fonts[i], FC_CHARSET, 0, &cs)
!= FcResultMatch)
{
fprintf(stderr, "no match\n");
FcPatternPrint(fs->fonts[i]);
goto nofont;
}
if(FcPatternGetString(fs->fonts[i], FC_FAMILY, 1, &family) !=FcResultMatch)
if(FcPatternGetString(fs->fonts[i], FC_FAMILY, 0, &family) != FcResultMatch)
goto nofont;
printf("[%d] %s ", i, (char *)family);
if(FcPatternGetString(fs->fonts[i], FC_FILE, 0, &file) != FcResultMatch)
goto nofont;
printf("(%s): ", (char *)file);
if(FcCharSetHasChar(cs, ch)){
puts("Yes");
}else{
puts("No");
}
}
FcFontSetDestroy(fs);
return 0;
nofont: return 1;
}
示例6: SetFallbackFont
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, SetFallbackFontCallback *callback)
{
if (!FcInit()) return false;
bool ret = false;
/* Fontconfig doesn't handle full language isocodes, only the part
* before the _ of e.g. en_GB is used, so "remove" everything after
* the _. */
char lang[16];
seprintf(lang, lastof(lang), ":lang=%s", language_isocode);
char *split = strchr(lang, '_');
if (split != NULL) *split = '\0';
/* First create a pattern to match the wanted language. */
FcPattern *pat = FcNameParse((FcChar8*)lang);
/* We only want to know the filename. */
FcObjectSet *os = FcObjectSetBuild(FC_FILE, NULL);
/* Get the list of filenames matching the wanted language. */
FcFontSet *fs = FcFontList(NULL, pat, os);
/* We don't need these anymore. */
FcObjectSetDestroy(os);
FcPatternDestroy(pat);
if (fs != NULL) {
for (int i = 0; i < fs->nfont; i++) {
FcPattern *font = fs->fonts[i];
FcChar8 *file = NULL;
FcResult res = FcPatternGetString(font, FC_FILE, 0, &file);
if (res != FcResultMatch || file == NULL) {
continue;
}
strecpy(settings->small_font, (const char*)file, lastof(settings->small_font));
strecpy(settings->medium_font, (const char*)file, lastof(settings->medium_font));
strecpy(settings->large_font, (const char*)file, lastof(settings->large_font));
bool missing = callback(NULL);
DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");
if (!missing) {
ret = true;
break;
}
}
/* Clean up the list of filenames. */
FcFontSetDestroy(fs);
}
FcFini();
return ret;
}
示例7: FcConfigDestroy
void
FcConfigDestroy (FcConfig *config)
{
FcSetName set;
FcExprPage *page;
if (FcRefDec (&config->ref) != 1)
return;
(void) fc_atomic_ptr_cmpexch (&_fcConfig, config, NULL);
FcStrSetDestroy (config->configDirs);
FcStrSetDestroy (config->fontDirs);
FcStrSetDestroy (config->cacheDirs);
FcStrSetDestroy (config->configFiles);
FcStrSetDestroy (config->acceptGlobs);
FcStrSetDestroy (config->rejectGlobs);
FcFontSetDestroy (config->acceptPatterns);
FcFontSetDestroy (config->rejectPatterns);
if (config->blanks)
FcBlanksDestroy (config->blanks);
FcSubstDestroy (config->substPattern);
FcSubstDestroy (config->substFont);
FcSubstDestroy (config->substScan);
for (set = FcSetSystem; set <= FcSetApplication; set++)
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
page = config->expr_pool;
while (page)
{
FcExprPage *next = page->next_page;
free (page);
page = next;
}
if (config->sysRoot)
FcStrFree (config->sysRoot);
free (config);
}
示例8: gp_enumerate_fonts_free
void gp_enumerate_fonts_free(void *enum_state)
{
#ifdef HAVE_FONTCONFIG
unix_fontenum_t* state = (unix_fontenum_t *)enum_state;
if (state != NULL) {
if (state->font_list != NULL)
FcFontSetDestroy(state->font_list);
free(state);
}
#endif
}
示例9: FcFontSetDestroy
FontPlatformData::~FontPlatformData()
{
#if !PLATFORM(JS)
if (m_fallbacks) {
FcFontSetDestroy(m_fallbacks);
m_fallbacks = 0;
}
#endif
if (m_scaledFont && m_scaledFont != hashTableDeletedFontValue())
cairo_scaled_font_destroy(m_scaledFont);
}
示例10: fcinfo
FcFontSet * fcinfo(const FcConfig *config, const FcPattern *pattern,
FcBool remove_duplicities, int argnum, ...)
{
va_list va;
const char *elements[argnum + 1];
int a;
FcFontSet *fontset;
FcObjectSet *objectset;
FcInit();
objectset = FcObjectSetCreate();
va_start(va, argnum);
for (a = 0; a < argnum; a++)
{
elements[a] = va_arg(va, const char *);
FcObjectSetAdd(objectset, elements[a]);
}
va_end(va);
fontset = FcFontList((FcConfig *)config, (FcPattern *)pattern, objectset);
elements[argnum] = NULL;
font_set_sort(fontset, elements);
FcObjectSetDestroy(objectset);
if (remove_duplicities)
{
FcFontSet *result = FcFontSetCreate();
int f;
FcPattern *added = NULL;
/* fontlist is linearly ordered */
f = 0;
while (f < fontset->nfont)
{
FcFontSetAdd(result, FcPatternDuplicate(fontset->fonts[f]));
added = fontset->fonts[f++];
while (f < fontset->nfont &&
!pattern_compare(&fontset->fonts[f], &added, elements))
f++;
}
FcFontSetDestroy(fontset);
return result;
}
return fontset;
}
示例11: FcPatternDestroy
void SimpleFontData::platformDestroy()
{
if (m_platformData.m_pattern && ((FcPattern*)-1 != m_platformData.m_pattern)) {
FcPatternDestroy(m_platformData.m_pattern);
m_platformData.m_pattern = 0;
}
if (m_platformData.m_fallbacks) {
FcFontSetDestroy(m_platformData.m_fallbacks);
m_platformData.m_fallbacks = 0;
}
if (m_smallCapsFontData)
delete m_smallCapsFontData;
m_smallCapsFontData = NULL;
}
示例12: lltxplatform_get_installed_fonts_impl
int lltxplatform_get_installed_fonts_impl(struct lltxplatform_fontinfo **const fonts, unsigned int *const count) {
int status = -1;
FcPattern *const pattern = FcPatternCreate();
if (pattern != NULL) {
FcObjectSet *const objects = FcObjectSetBuild(FC_FULLNAME, FC_FILE, NULL);
if (objects != NULL) {
FcFontSet *const list = FcFontList(NULL, pattern, objects);
if (list != NULL) {
if (list->nfont > 0) {
const unsigned int cnt = (unsigned int) list->nfont;
struct lltxplatform_fontinfo *const array = (struct lltxplatform_fontinfo *) calloc((size_t) cnt, sizeof(struct lltxplatform_fontinfo));
if (array != NULL) {
unsigned int i;
status = 0;
for (i = 0; i < cnt; ++i) {
struct lltxplatform_fontinfo *const info = &array[i];
FcPattern *const font = list->fonts[i];
FcChar8 *value;
if (FcPatternGetString(font, FC_FULLNAME, 0, &value) == FcResultMatch) {
info->name = strdup((char *) value);
} else {
info->name = NULL;
}
if (FcPatternGetString(font, FC_FILE, 0, &value) == FcResultMatch) {
info->path = strdup((char *) value);
} else {
info->path = NULL;
}
}
*count = cnt;
*fonts = array;
}
} else {
status = 0;
*count = 0;
*fonts = NULL;
}
FcFontSetDestroy(list);
}
FcObjectSetDestroy(objects);
}
FcPatternDestroy(pattern);
}
return status;
}
示例13: FcListFonts
GeeArrayList *
FcListFonts(gchar * family_name)
{
int i;
FcPattern * pattern;
FcFontSet * fontset;
FcObjectSet * objectset = 0;
GeeArrayList * fontlist = gee_array_list_new(G_TYPE_OBJECT,
NULL,
NULL,
NULL,
NULL,
NULL);
g_assert(FcInit());
if (family_name)
pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, family_name, NULL);
else
pattern = FcNameParse((FcChar8 *) ":");
objectset = FcObjectSetBuild (FC_FILE,
FC_INDEX,
FC_FAMILY,
FC_STYLE,
FC_SLANT,
FC_WEIGHT,
FC_WIDTH,
FC_SPACING,
NULL);
fontset = FcFontList(NULL, pattern, objectset);
for (i = 0; i < fontset->nfont; i++) {
FontConfigFont * font = font_config_font_new();
get_font_details_from_pattern(font, fontset->fonts[i]);
gee_abstract_collection_add((GeeAbstractCollection *) fontlist, font);
}
if (objectset)
FcObjectSetDestroy(objectset);
if (pattern)
FcPatternDestroy(pattern);
if (fontset)
FcFontSetDestroy(fontset);
return fontlist;
}
示例14: evas_fonts_zero_free
void
evas_fonts_zero_free(Evas *eo_evas)
{
Fndat *fd;
Evas_Public_Data *evas = eo_data_get(eo_evas, EVAS_CLASS);
EINA_LIST_FREE(fonts_zero, fd)
{
if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
if (fd->source) eina_stringshare_del(fd->source);
evas->engine.func->font_free(evas->engine.data.output, fd->font);
#ifdef HAVE_FONTCONFIG
if (fd->set) FcFontSetDestroy(fd->set);
if (fd->p_nm) FcPatternDestroy(fd->p_nm);
#endif
free(fd);
}
}
示例15: FcInit
FcFontSet *fcinfo_font_index(const FcPattern *filter)
{
FcFontSet *result, *fontset;
FcInit();
fontset = fcinfo(NULL, filter, FcFalse, 5,
FC_FAMILY,
FC_STYLE,
FC_LANG,/* fonts like Misc Fixed need
to be sorted by LANG (subset-like) */
FC_PIXEL_SIZE,
FC_FILE); /* for identifying the best font in
FC_LANG terms */
result = fcinfo_match(fontset, NULL);
FcFontSetDestroy(fontset);
return result;
}