Top | ![]() |
![]() |
![]() |
![]() |
#define | FONT_MANAGER_CURRENT_DATABASE_VERSION |
#define | FONT_MANAGER_TYPE_DATABASE |
#define | FONT_MANAGER_TYPE_DATABASE_ITERATOR |
enum | FontManagerDatabaseError |
#define | FONT_MANAGER_TYPE_DATABASE_ERROR |
struct | FontManagerDatabase |
enum | FontManagerDatabaseType |
#define | FONT_MANAGER_TYPE_DATABASE_TYPE |
FontManagerDatabaseIterator |
GEnum ├── FontManagerDatabaseError ╰── FontManagerDatabaseType GObject ├── FontManagerDatabase ╰── FontManagerDatabaseIterator
Database class and related functions.
The current design uses a three separate database files. The first holds information required for basic font identification, the second holds all the metadata extracted from the font file itself and the third has information related to orthography support.
These are then attached to the "base" database for access.
const gchar *
font_manager_database_get_type_name (FontManagerDatabaseType type
);
gchar *
font_manager_database_get_file (FontManagerDatabaseType type
);
void font_manager_database_open (FontManagerDatabase *self
,GError **error
);
Open database.
Note: It is not necessary to call this function in normal usage. The methods provided by this class will open the database if needed.
void font_manager_database_begin_transaction (FontManagerDatabase *self
,GError **error
);
Begin a transaction, this should be paired with
font_manager_database_commit_transaction()
.
void font_manager_database_commit_transaction (FontManagerDatabase *self
,GError **error
);
End a transaction. It is an error to call this function without having
previously called font_manager_database_begin_transaction()
.
void font_manager_database_execute_query (FontManagerDatabase *self
,const gchar *sql
,GError **error
);
gint font_manager_database_get_version (FontManagerDatabase *self
,GError **error
);
void font_manager_database_set_version (FontManagerDatabase *self
,int version
,GError **error
);
Set database schema version.
void font_manager_database_vacuum (FontManagerDatabase *self
,GError **error
);
Run sqlite3 VACUUM command on currently selected database.
void font_manager_database_initialize (FontManagerDatabase *self
,FontManagerDatabaseType type
,GError **error
);
Ensures database is at latest schema version. Creates required tables if needed.
void font_manager_database_attach (FontManagerDatabase *self
,FontManagerDatabaseType type
,GError **error
);
Attaches speficied database.
void font_manager_database_detach (FontManagerDatabase *self
,FontManagerDatabaseType type
,GError **error
);
Detaches speficied database.
JsonObject * font_manager_database_get_object (FontManagerDatabase *self
,const gchar *sql
,GError **error
);
FontManagerDatabaseIterator *
font_manager_database_iterator (FontManagerDatabase *self
);
FontManagerDatabaseIterator *
font_manager_database_iterator_new (FontManagerDatabase *db
);
A newly created FontManagerDatabaseIterator.
Free the returned object using g_object_unref()
.
[transfer full]
gboolean
font_manager_database_iterator_next (FontManagerDatabaseIterator *self
);
sqlite3_stmt *
font_manager_database_iterator_get (FontManagerDatabaseIterator *self
);
[skip]
FontManagerDatabase * font_manager_get_database (FontManagerDatabaseType type
,GError **error
);
Convenience function which initializes the database and sets default options.
The requested FontManagerDatabase or NULL
on error.
Free the returned object using
. g_object_unref()
[transfer full][nullable]
gboolean font_manager_update_database_sync (FontManagerDatabase *db
,FontManagerDatabaseType type
,JsonObject *available_fonts
,FontManagerStringSet *available_files
,FontManagerProgressCallback progress
,GCancellable *cancellable
,GError **error
);
Update application database as needed.
db |
FontManagerDatabase instance |
|
type |
||
available_fonts |
JsonObject returned by font_manager_list_available_fonts |
|
available_files |
FontManagerStringSet containing filepaths for all available font files |
|
progress |
[scope call][nullable] | |
cancellable |
GCancellable or |
[nullable] |
error |
GError or |
[nullable] |
void font_manager_update_database (FontManagerDatabase *db
,FontManagerDatabaseType type
,JsonObject *available_fonts
,FontManagerStringSet *available_files
,FontManagerProgressCallback progress
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Update application database as needed.
db |
FontManagerDatabase instance |
|
type |
||
available_fonts |
JsonObject returned by font_manager_list_available_fonts |
|
available_files |
FontManagerStringSet containing filepaths for all available font files |
|
progress |
[scope call][nullable] | |
cancellable |
GCancellable or |
[nullable] |
callback |
GAsyncReadyCallback or |
[nullable][scope async] |
user_data |
user data passed to callback or |
[nullable] |
gboolean font_manager_update_database_finish (GAsyncResult *result
,GError **error
);
void font_manager_get_matching_families_and_fonts (FontManagerDatabase *db
,FontManagerStringSet *families
,FontManagerStringSet *fonts
,const gchar *sql
,GError **error
);
Query MUST return two result columns. The first containing the family name and the second containing the font description.
#define FONT_MANAGER_TYPE_DATABASE_ITERATOR (font_manager_database_iterator_get_type())
These errors map directly to SQLite error codes. See https://sqlite.org/rescode.html for more detailed information.
SQLITE_OK |
||
SQLITE_ERROR |
||
SQLITE_INTERNAL |
||
SQLITE_PERM |
||
SQLITE_ABORT |
||
SQLITE_BUSY |
||
SQLITE_LOCKED |
||
SQLITE_NOMEM |
||
SQLITE_READONLY |
||
SQLITE_INTERRUPT |
||
SQLITE_IOERR |
||
SQLITE_CORRUPT |
||
SQLITE_NOTFOUND |
||
SQLITE_FULL |
||
SQLITE_CANTOPEN |
||
SQLITE_PROTOCOL |
||
SQLITE_EMPTY |
||
SQLITE_SCHEMA |
||
SQLITE_TOOBIG |
||
SQLITE_CONSTRAINT |
||
SQLITE_MISMATCH |
||
SQLITE_MISUSE |
||
SQLITE_NOLFS |
||
SQLITE_AUTH |
||
SQLITE_FORMAT |
||
SQLITE_RANGE |
||
SQLITE_NOTADB |
||
SQLITE_NOTICE |
||
SQLITE_WARNING |
||
SQLITE_ROW |
||
SQLITE_DONE |
#define FONT_MANAGER_TYPE_DATABASE_ERROR (font_manager_database_error_get_type ())
#define FONT_MANAGER_TYPE_DATABASE_TYPE (font_manager_database_type_get_type ())