summaryrefslogtreecommitdiffstats
path: root/libass/ass_types.h
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2011-08-20 18:19:25 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2015-07-10 10:42:40 +0200
commit4803b0a7bc9fee78e9eafb7417fa20f9a21d675f (patch)
tree19a12b4c387d5c4909f3275fe72e316e79e9416a /libass/ass_types.h
parentf69ec6e0c038fe32cc5f91cc62cba52fe3934885 (diff)
downloadlibass-4803b0a7bc9fee78e9eafb7417fa20f9a21d675f.tar.bz2
libass-4803b0a7bc9fee78e9eafb7417fa20f9a21d675f.tar.xz
Export font provider interface
Add wrapper to the ASS_Renderer to create a font provider from its internal font selector and shuffle some code around to export everything that's needed for font providers to the public. Document font provider functions.
Diffstat (limited to 'libass/ass_types.h')
-rw-r--r--libass/ass_types.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/libass/ass_types.h b/libass/ass_types.h
index ccb0a0e..01e7306 100644
--- a/libass/ass_types.h
+++ b/libass/ass_types.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
+ * Copyright (C) 2011 Grigori Goronzy <greg@chown.ath.cx>
*
* This file is part of libass.
*
@@ -28,11 +29,47 @@
#define HALIGN_CENTER 2
#define HALIGN_RIGHT 3
+#define FONT_WEIGHT_LIGHT 300
+#define FONT_WEIGHT_MEDIUM 400
+#define FONT_WEIGHT_BOLD 700
+#define FONT_SLANT_NONE 0
+#define FONT_SLANT_ITALIC 100
+#define FONT_SLANT_OBLIQUE 110
+
+
/* Opaque objects internally used by libass. Contents are private. */
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 void *(*GetFaceFunc)(void *, size_t *);
+typedef int (*CheckGlyphFunc)(void *, uint32_t);
+typedef void (*DestroyFontFunc)(void *);
+typedef void (*DestroyProviderFunc)(void *);
+
+typedef struct font_provider_funcs {
+ GetFaceFunc get_face; // callback for memory fonts
+ CheckGlyphFunc check_glyph; // test codepoint for coverage
+ DestroyFontFunc destroy_font; // destroy a single font
+ DestroyProviderFunc destroy_provider; // destroy provider only
+} ASS_FontProviderFuncs;
+
+/*
+ * Basic font metadata. All strings must be encoded with UTF-8.
+ * At minimum `family' is required.
+ */
+typedef struct font_provider_meta_data {
+ char *family; // English font family, e.g. "Arial"
+ char **fullnames; // list of localized full names, e.g. "Arial Bold"
+ int n_fullname; // number of localized full names
+ int slant; // uses the above scale (NONE/ITALIC/OBLIQUE)
+ int weight; // TrueType scale, 100-900
+} ASS_FontProviderMetaData;
+
/* ASS Style: line */
typedef struct ass_style {
@@ -63,6 +100,7 @@ typedef struct ass_style {
double Blur;
} ASS_Style;
+
/*
* ASS_Event corresponds to a single Dialogue line;
* text is stored as-is, style overrides will be parsed later.