SAFE_CFRelease(set);
}
-static int check_glyph(void *priv, uint32_t code)
+static bool check_glyph(void *priv, uint32_t code)
{
CFCharacterSetRef set = priv;
if (!set)
- return 1;
+ return true;
if (code == 0)
- return 1;
+ return true;
return CFCharacterSetIsLongCharacterMember(set, code);
}
}
/*
- * Checks if the passed font has a specific unicode
- * character. Returns 0 for failure and 1 for success
+ * Check if the passed font has a specific unicode character.
*/
-static int check_glyph(void *data, uint32_t code)
+static bool check_glyph(void *data, uint32_t code)
{
HRESULT hr = S_OK;
FontPrivate *priv = (FontPrivate *) data;
BOOL exists = FALSE;
if (code == 0)
- return 1;
+ return true;
hr = IDWriteFont_HasCharacter(priv->font, code, &exists);
if (FAILED(hr))
- return 0;
+ return false;
return exists;
}
FcCharSet *fallback_chars;
} ProviderPrivate;
-static int check_glyph(void *priv, uint32_t code)
+static bool check_glyph(void *priv, uint32_t code)
{
FcPattern *pat = (FcPattern *)priv;
FcCharSet *charset;
if (!pat)
- return 1;
+ return true;
if (code == 0)
- return 1;
+ return true;
FcResult result = FcPatternGetCharSet(pat, FC_CHARSET, 0, &charset);
if (result != FcResultMatch)
- return 0;
+ return false;
if (FcCharSetHasChar(charset, code) == FcTrue)
- return 1;
- return 0;
+ return true;
+ return false;
}
static void destroy(void *priv)
int idx;
};
-static int check_glyph_ft(void *data, uint32_t codepoint)
+static bool check_glyph_ft(void *data, uint32_t codepoint)
{
FontDataFT *fd = (FontDataFT *)data;
if (!codepoint)
- return 1;
+ return true;
return !!FT_Get_Char_Index(fd->face, codepoint);
}
* \param data private data for the font
* \return success
*/
-int
+bool
ass_font_provider_add_font(ASS_FontProvider *provider,
ASS_FontProviderMetaData *meta, const char *path,
int index, void *data)
info->provider = provider;
selector->n_font++;
- return 0;
+ return false;
error:
ass_font_provider_free_fontinfo(info);
- return 1;
+ return true;
}
/**
}
#endif
-static int check_glyph(ASS_FontInfo *fi, uint32_t code)
+static bool check_glyph(ASS_FontInfo *fi, uint32_t code)
{
ASS_FontProvider *provider = fi->provider;
assert(provider && provider->funcs.check_glyph);
* \param info metadata, returned here
* \return success
*/
-static int
+static bool
get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info)
{
int i;
// we're only interested in outlines
if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
- return 0;
+ return false;
for (i = 0; i < num_names; i++) {
FT_SfntName name;
info->n_fullname = num_fullname;
}
- return 0;
+ return false;
error:
for (i = 0; i < num_family; i++)
free(info->fullnames);
free(postscript_name);
- return 1;
+ return true;
}
/**
*
* \param font_priv font private data
* \param codepont Unicode codepoint (UTF-32)
- * \return non-zero value if codepoint is supported by the font
+ * \return true if codepoint is supported by the font
*/
-typedef int (*CheckGlyphFunc)(void *font_priv, uint32_t codepoint);
+typedef bool (*CheckGlyphFunc)(void *font_priv, uint32_t codepoint);
/**
* Destroy a font's private data.
* \return success
*
*/
-int
+bool
ass_font_provider_add_font(ASS_FontProvider *provider,
ASS_FontProviderMetaData *meta, const char *path,
int index, void *data);