summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libass/ass.h35
-rw-r--r--libass/ass_font.h6
-rw-r--r--libass/ass_fontselect.h180
-rw-r--r--libass/ass_types.h136
-rw-r--r--libass/libass.sym3
5 files changed, 180 insertions, 180 deletions
diff --git a/libass/ass.h b/libass/ass.h
index 1fb571b..5fdee10 100644
--- a/libass/ass.h
+++ b/libass/ass.h
@@ -472,41 +472,6 @@ void ass_set_selective_style_override(ASS_Renderer *priv, ASS_Style *style);
int ass_fonts_update(ASS_Renderer *priv);
/**
- * \brief Create an empty font provider. A font provider can be used to
- * provide additional fonts to libass.
- * \param priv parent renderer
- * \param funcs callback functions
- * \param private data for provider callbacks
- *
- */
-ASS_FontProvider *
-ass_create_font_provider(ASS_Renderer *priv, ASS_FontProviderFuncs *funcs,
- void *data);
-
-/**
- * \brief Add a font to a font provider.
- * \param provider the font provider
- * \param meta font metadata. See struct definition for more information.
- * \param path absolute path to font, or NULL for memory-based fonts
- * \param index index inside a font collection file
- * \param psname PostScript name of the face (overrides index if present)
- * \param data private data for font callbacks
- * \return success
- *
- */
-int
-ass_font_provider_add_font(ASS_FontProvider *provider,
- ASS_FontProviderMetaData *meta, const char *path,
- unsigned int index, const char *psname, void *data);
-
-/**
- * \brief Free font provider and associated fonts.
- * \param provider the font provider
- *
- */
-void ass_font_provider_free(ASS_FontProvider *provider);
-
-/**
* \brief Set hard cache limits. Do not set, or set to zero, for reasonable
* defaults.
*
diff --git a/libass/ass_font.h b/libass/ass_font.h
index fb6462b..693cabf 100644
--- a/libass/ass_font.h
+++ b/libass/ass_font.h
@@ -26,7 +26,6 @@
typedef struct ass_font ASS_Font;
typedef struct ass_font_desc ASS_FontDesc;
-typedef struct ass_font_stream ASS_FontStream;
#include "ass.h"
#include "ass_types.h"
@@ -59,11 +58,6 @@ struct ass_font {
double size;
};
-struct ass_font_stream {
- GetDataFunc func;
- void *priv;
-};
-
void charmap_magic(ASS_Library *library, FT_Face face);
ASS_Font *ass_font_new(Cache *font_cache, ASS_Library *library,
FT_Library ftlibrary, ASS_FontSelector *fontsel,
diff --git a/libass/ass_fontselect.h b/libass/ass_fontselect.h
index 267b6fe..2c03a16 100644
--- a/libass/ass_fontselect.h
+++ b/libass/ass_fontselect.h
@@ -31,6 +31,151 @@ typedef struct font_info ASS_FontInfo;
#include "ass.h"
#include "ass_font.h"
+typedef struct font_provider ASS_FontProvider;
+
+/* Font Provider */
+typedef struct ass_font_provider_meta_data ASS_FontProviderMetaData;
+
+/**
+ * Get font data. This is a stream interface which can be used as an
+ * alternative to providing a font path (which may not be available).
+ *
+ * This is called by fontselect if a given font was added without a
+ * font path (i.e. the path was set to NULL).
+ *
+ * \param font_priv font private data
+ * \param output buffer; set to NULL to query stream size
+ * \param offset stream offset
+ * \param len bytes to read into output buffer from stream
+ * \return actual number of bytes read, or stream size if data == NULL
+ */
+typedef size_t (*GetDataFunc)(void *font_priv, unsigned char *data,
+ size_t offset, size_t len);
+
+/**
+ * Check if a glyph is supported by a font.
+ *
+ * \param font_priv font private data
+ * \param codepont Unicode codepoint (UTF-32)
+ * \return non-zero value if codepoint is supported by the font
+ */
+typedef int (*CheckGlyphFunc)(void *font_priv, uint32_t codepoint);
+
+/**
+ * Destroy a font's private data.
+ *
+ * \param font_priv font private data
+ */
+typedef void (*DestroyFontFunc)(void *font_priv);
+
+/**
+ * Destroy a font provider's private data.
+ *
+ * \param priv font provider private data
+ */
+typedef void (*DestroyProviderFunc)(void *priv);
+
+/**
+ * Add fonts for a given font name; this should add all fonts matching the
+ * given name to the fontselect database.
+ *
+ * This is called by fontselect whenever a new logical font is created. The
+ * font provider set as default is used.
+ *
+ * \param lib ASS_Library instance
+ * \param provider font provider instance
+ * \param name font name (as specified in script)
+ */
+typedef void (*MatchFontsFunc)(ASS_Library *lib,
+ ASS_FontProvider *provider,
+ char *name);
+
+/**
+ * Substitute font name by another. This implements generic font family
+ * substitutions (e.g. sans-serif, serif, monospace) as well as font aliases.
+ *
+ * The generic families should map to sensible platform-specific font families.
+ * Aliases are sometimes used to map from common fonts that don't exist on
+ * a particular platform to similar alternatives. For example, a Linux
+ * system with fontconfig may map "Arial" to "Liberation Sans" and Windows
+ * maps "Helvetica" to "Arial".
+ *
+ * This is called by fontselect when a new logical font is created. The font
+ * provider set as default is used.
+ *
+ * \param priv font provider private data
+ * \param name input string for substitution, as specified in the script
+ * \param meta metadata (fullnames and n_fullname) to be filled in
+ */
+typedef void (*SubstituteFontFunc)(void *priv, const char *name,
+ ASS_FontProviderMetaData *meta);
+
+/**
+ * Get an appropriate fallback font for a given codepoint.
+ *
+ * This is called by fontselect whenever a glyph is not found in the
+ * physical font list of a logical font. fontselect will try to add the
+ * font family with match_fonts if it does not exist in the font list
+ * add match_fonts is not NULL. Note that the returned font family should
+ * contain the requested codepoint.
+ *
+ * Note that fontselect uses the font provider set as default to determine
+ * fallbacks.
+ *
+ * \param font_priv font private data
+ * \param codepoint Unicode codepoint (UTF-32)
+ * \return output font family, allocated with malloc(), must be freed
+ * by caller.
+ */
+typedef char *(*GetFallbackFunc)(void *font_priv,
+ ASS_FontProviderMetaData *meta,
+ uint32_t codepoint);
+
+typedef struct font_provider_funcs {
+ GetDataFunc get_data; /* optional/mandatory */
+ CheckGlyphFunc check_glyph; /* mandatory */
+ DestroyFontFunc destroy_font; /* optional */
+ DestroyProviderFunc destroy_provider; /* optional */
+ MatchFontsFunc match_fonts; /* optional */
+ SubstituteFontFunc subst_font; /* optional */
+ GetFallbackFunc fallback_font; /* optional */
+} ASS_FontProviderFuncs;
+
+/*
+ * Basic font metadata. All strings must be encoded with UTF-8.
+ * At minimum one family is required.
+ */
+struct ass_font_provider_meta_data {
+
+ /**
+ * List of localized font family names, e.g. "Arial".
+ */
+ char **families;
+
+ /**
+ * List of localized full names, e.g. "Arial Bold".
+ * The English name should be listed first to speed up typical matching.
+ */
+ char **fullnames;
+ int n_family; // Number of localized family names
+ int n_fullname; // Number of localized full names
+
+ int slant; // Font slant value from FONT_SLANT_*
+ int weight; // Font weight in TrueType scale, 100-900
+ // See FONT_WEIGHT_*
+ int width; // Font weight in percent, normally 100
+ // See FONT_WIDTH_*
+};
+
+typedef struct ass_font_stream ASS_FontStream;
+
+struct ass_font_stream {
+ // GetDataFunc
+ size_t (*func)(void *font_priv, unsigned char *data,
+ size_t offset, size_t len);
+ void *priv;
+};
+
ASS_FontSelector *
ass_fontselect_init(ASS_Library *library,
FT_Library ftlibrary, const char *family,
@@ -45,4 +190,39 @@ void ass_fontselect_free(ASS_FontSelector *priv);
ASS_FontProvider *ass_font_provider_new(ASS_FontSelector *selector,
ASS_FontProviderFuncs *funcs, void *data);
+/**
+ * \brief Create an empty font provider. A font provider can be used to
+ * provide additional fonts to libass.
+ * \param priv parent renderer
+ * \param funcs callback functions
+ * \param private data for provider callbacks
+ *
+ */
+ASS_FontProvider *
+ass_create_font_provider(ASS_Renderer *priv, ASS_FontProviderFuncs *funcs,
+ void *data);
+
+/**
+ * \brief Add a font to a font provider.
+ * \param provider the font provider
+ * \param meta font metadata. See struct definition for more information.
+ * \param path absolute path to font, or NULL for memory-based fonts
+ * \param index index inside a font collection file
+ * \param psname PostScript name of the face (overrides index if present)
+ * \param data private data for font callbacks
+ * \return success
+ *
+ */
+int
+ass_font_provider_add_font(ASS_FontProvider *provider,
+ ASS_FontProviderMetaData *meta, const char *path,
+ unsigned int index, const char *psname, void *data);
+
+/**
+ * \brief Free font provider and associated fonts.
+ * \param provider the font provider
+ *
+ */
+void ass_font_provider_free(ASS_FontProvider *provider);
+
#endif /* LIBASS_FONTCONFIG_H */
diff --git a/libass/ass_types.h b/libass/ass_types.h
index f56a754..f4a6ae5 100644
--- a/libass/ass_types.h
+++ b/libass/ass_types.h
@@ -45,142 +45,6 @@ typedef struct ass_renderer ASS_Renderer;
typedef struct render_priv ASS_RenderPriv;
typedef struct parser_priv ASS_ParserPriv;
typedef struct ass_library ASS_Library;
-typedef struct font_provider ASS_FontProvider;
-
-/* Font Provider */
-typedef struct ass_font_provider_meta_data ASS_FontProviderMetaData;
-
-/**
- * Get font data. This is a stream interface which can be used as an
- * alternative to providing a font path (which may not be available).
- *
- * This is called by fontselect if a given font was added without a
- * font path (i.e. the path was set to NULL).
- *
- * \param font_priv font private data
- * \param output buffer; set to NULL to query stream size
- * \param offset stream offset
- * \param len bytes to read into output buffer from stream
- * \return actual number of bytes read, or stream size if data == NULL
- */
-typedef size_t (*GetDataFunc)(void *font_priv, unsigned char *data,
- size_t offset, size_t len);
-
-/**
- * Check if a glyph is supported by a font.
- *
- * \param font_priv font private data
- * \param codepont Unicode codepoint (UTF-32)
- * \return non-zero value if codepoint is supported by the font
- */
-typedef int (*CheckGlyphFunc)(void *font_priv, uint32_t codepoint);
-
-/**
- * Destroy a font's private data.
- *
- * \param font_priv font private data
- */
-typedef void (*DestroyFontFunc)(void *font_priv);
-
-/**
- * Destroy a font provider's private data.
- *
- * \param priv font provider private data
- */
-typedef void (*DestroyProviderFunc)(void *priv);
-
-/**
- * Add fonts for a given font name; this should add all fonts matching the
- * given name to the fontselect database.
- *
- * This is called by fontselect whenever a new logical font is created. The
- * font provider set as default is used.
- *
- * \param lib ASS_Library instance
- * \param provider font provider instance
- * \param name font name (as specified in script)
- */
-typedef void (*MatchFontsFunc)(ASS_Library *lib,
- ASS_FontProvider *provider,
- char *name);
-
-/**
- * Substitute font name by another. This implements generic font family
- * substitutions (e.g. sans-serif, serif, monospace) as well as font aliases.
- *
- * The generic families should map to sensible platform-specific font families.
- * Aliases are sometimes used to map from common fonts that don't exist on
- * a particular platform to similar alternatives. For example, a Linux
- * system with fontconfig may map "Arial" to "Liberation Sans" and Windows
- * maps "Helvetica" to "Arial".
- *
- * This is called by fontselect when a new logical font is created. The font
- * provider set as default is used.
- *
- * \param priv font provider private data
- * \param name input string for substitution, as specified in the script
- * \param meta metadata (fullnames and n_fullname) to be filled in
- */
-typedef void (*SubstituteFontFunc)(void *priv, const char *name,
- ASS_FontProviderMetaData *meta);
-
-/**
- * Get an appropriate fallback font for a given codepoint.
- *
- * This is called by fontselect whenever a glyph is not found in the
- * physical font list of a logical font. fontselect will try to add the
- * font family with match_fonts if it does not exist in the font list
- * add match_fonts is not NULL. Note that the returned font family should
- * contain the requested codepoint.
- *
- * Note that fontselect uses the font provider set as default to determine
- * fallbacks.
- *
- * \param font_priv font private data
- * \param codepoint Unicode codepoint (UTF-32)
- * \return output font family, allocated with malloc(), must be freed
- * by caller.
- */
-typedef char *(*GetFallbackFunc)(void *font_priv,
- ASS_FontProviderMetaData *meta,
- uint32_t codepoint);
-
-typedef struct font_provider_funcs {
- GetDataFunc get_data; /* optional/mandatory */
- CheckGlyphFunc check_glyph; /* mandatory */
- DestroyFontFunc destroy_font; /* optional */
- DestroyProviderFunc destroy_provider; /* optional */
- MatchFontsFunc match_fonts; /* optional */
- SubstituteFontFunc subst_font; /* optional */
- GetFallbackFunc fallback_font; /* optional */
-} ASS_FontProviderFuncs;
-
-/*
- * Basic font metadata. All strings must be encoded with UTF-8.
- * At minimum one family is required.
- */
-struct ass_font_provider_meta_data {
-
- /**
- * List of localized font family names, e.g. "Arial".
- */
- char **families;
-
- /**
- * List of localized full names, e.g. "Arial Bold".
- * The English name should be listed first to speed up typical matching.
- */
- char **fullnames;
- int n_family; // Number of localized family names
- int n_fullname; // Number of localized full names
-
- int slant; // Font slant value from FONT_SLANT_*
- int weight; // Font weight in TrueType scale, 100-900
- // See FONT_WEIGHT_*
- int width; // Font weight in percent, normally 100
- // See FONT_WIDTH_*
-};
-
/* ASS Style: line */
typedef struct ass_style {
diff --git a/libass/libass.sym b/libass/libass.sym
index 8a6826a..5cdca1f 100644
--- a/libass/libass.sym
+++ b/libass/libass.sym
@@ -42,6 +42,3 @@ ass_set_line_position
ass_set_pixel_aspect
ass_set_selective_style_override_enabled
ass_set_selective_style_override
-ass_create_font_provider
-ass_font_provider_add_font
-ass_font_provider_free