NetSurf
|
Font glyph scanner for Unicode substitutions. More...
#include "amiga/os3support.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <proto/bullet.h>
#include <proto/diskfont.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <diskfont/diskfonttag.h>
#include <diskfont/oterrors.h>
#include <proto/window.h>
#include <proto/layout.h>
#include <proto/fuelgauge.h>
#include <classes/window.h>
#include <gadgets/fuelgauge.h>
#include <gadgets/layout.h>
#include <reaction/reaction_macros.h>
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "amiga/font_scan.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
#include "amiga/object.h"
#include "amiga/utf8.h"
Go to the source code of this file.
Data Structures | |
struct | ami_font_scan_window |
Enumerations | |
enum | { FS_OID_MAIN = 0 , FS_GID_MAIN , FS_GID_FONTS , FS_GID_GLYPHS , FS_GID_LAST } |
Functions | |
const char * | ami_font_scan_lookup (const uint16 *code, lwc_string **glypharray) |
Lookup a font that contains a UTF-16 codepoint. More... | |
static struct ami_font_scan_window * | ami_font_scan_gui_open (int32 fonts) |
Open GUI to show font scanning progress. More... | |
static void | ami_font_scan_gui_update (struct ami_font_scan_window *fsw, const char *font, ULONG font_num, ULONG glyphs) |
Update GUI showing font scanning progress. More... | |
static void | ami_font_scan_gui_close (struct ami_font_scan_window *fsw) |
Close GUI showing font scanning progress. More... | |
static ULONG | ami_font_scan_font (const char *fontname, lwc_string **glypharray) |
Scan a font for glyphs not present in glypharray. More... | |
static ULONG | ami_font_scan_fonts (struct MinList *list, struct ami_font_scan_window *win, lwc_string **glypharray) |
Scan all fonts for glyphs. More... | |
static ULONG | ami_font_scan_list (struct MinList *list) |
Add OS fonts to a list. More... | |
static ULONG | ami_font_scan_load (const char *filename, lwc_string **glypharray) |
Load a font glyph cache. More... | |
void | ami_font_scan_save (const char *filename, lwc_string **glypharray) |
Save a font glyph cache. More... | |
void | ami_font_scan_fini (lwc_string **glypharray) |
Finalise the font glyph cache. More... | |
void | ami_font_scan_init (const char *filename, bool force_scan, bool save, lwc_string **glypharray) |
Initialise the font glyph cache. More... | |
Font glyph scanner for Unicode substitutions.
Definition in file font_scan.c.
anonymous enum |
Enumerator | |
---|---|
FS_OID_MAIN | |
FS_GID_MAIN | |
FS_GID_FONTS | |
FS_GID_GLYPHS | |
FS_GID_LAST |
Definition at line 60 of file font_scan.c.
void ami_font_scan_fini | ( | lwc_string ** | glypharray | ) |
Finalise the font glyph cache.
glypharray | an array of 0xffff lwc_string pointers to free |
Definition at line 452 of file font_scan.c.
References glypharray.
Referenced by ami_font_finiscanner().
|
static |
Scan a font for glyphs not present in glypharray.
fontname | font to scan |
glypharray | an array of 0xffff lwc_string pointers |
Definition at line 215 of file font_scan.c.
References AMI_OFONT_ENGINE, OutlineFont::BulletBase, CloseOutlineFont(), EObtainInfo, EReleaseInfo, ESetInfo, GetHead(), GetSucc(), glypharray, NSLOG, nsoption_charp, nsoption_set_charp, OFF_OPEN, and OpenOutlineFont().
Referenced by ami_font_scan_fonts().
|
static |
Scan all fonts for glyphs.
list | min list |
win | scan window |
glypharray | an array of 0xffff lwc_string pointers |
Definition at line 282 of file font_scan.c.
References ami_font_scan_font(), ami_font_scan_gui_update(), nsObject::dtz_Node, GetHead(), GetSucc(), glypharray, IsMinListEmpty, and NSLOG.
Referenced by ami_font_scan_init().
|
static |
Close GUI showing font scanning progress.
fsw | pointer to a struct ami_font_scan_window |
Definition at line 199 of file font_scan.c.
References ami_utf8_free(), FS_OID_MAIN, ami_font_scan_window::objects, and ami_font_scan_window::title.
Referenced by ami_font_scan_init().
|
static |
Open GUI to show font scanning progress.
fonts | number of fonts that are being scanned |
Definition at line 99 of file font_scan.c.
References ami_gui_get_screen(), ami_gui_get_screen_title(), ami_utf8_easy(), FS_GID_FONTS, FS_GID_GLYPHS, FS_GID_MAIN, FS_OID_MAIN, FuelGaugeObj, ami_font_scan_window::glyphtext, LayoutVObj, messages_get(), ami_font_scan_window::objects, ami_font_scan_window::title, ami_font_scan_window::win, and WindowObj.
Referenced by ami_font_scan_init().
|
static |
Update GUI showing font scanning progress.
fsw | pointer to a struct ami_font_scan_window |
font | current font being scanned |
font_num | font number being scanned |
glyphs | number of unique glyphs found |
Definition at line 167 of file font_scan.c.
References FS_GID_FONTS, FS_GID_GLYPHS, ami_font_scan_window::glyphtext, ami_font_scan_window::objects, RefreshSetGadgetAttrs(), and ami_font_scan_window::win.
Referenced by ami_font_scan_fonts().
void ami_font_scan_init | ( | const char * | filename, |
bool | force_scan, | ||
bool | save, | ||
lwc_string ** | glypharray | ||
) |
Initialise the font glyph cache.
Reads an existing file or, if not present, generates a new cache.
filename | cache file to attempt to read |
force_scan | force re-creation of cache |
save | save the cache |
glypharray | an array of 0xffff lwc_string pointers |
Definition at line 474 of file font_scan.c.
References AddObject(), ami_font_scan_fonts(), ami_font_scan_gui_close(), ami_font_scan_gui_open(), ami_font_scan_list(), ami_font_scan_load(), ami_font_scan_save(), AMINS_UNKNOWN, nsObject::dtz_Node, FreeObjList(), glypharray, NewObjList(), NSLOG, nsoption_bool, nsoption_charp, and strsep().
Referenced by ami_font_initscanner().
|
static |
Add OS fonts to a list.
list | list to add font names to |
Definition at line 313 of file font_scan.c.
References AddObject(), AFF_OTAG, AMINS_UNKNOWN, nsObject::dtz_Node, FindIName, and NSLOG.
Referenced by ami_font_scan_init().
|
static |
Load a font glyph cache.
filename | name of cache file to load |
glypharray | an array of 0xffff lwc_string pointers |
Definition at line 371 of file font_scan.c.
References buffer, FClose, FOpen, glypharray, and NSLOG.
Referenced by ami_font_scan_init().
const char * ami_font_scan_lookup | ( | const uint16 * | code, |
lwc_string ** | glypharray | ||
) |
Lookup a font that contains a UTF-16 codepoint.
code | UTF-16 codepoint to lookup |
glypharray | an array of 0xffff lwc_string pointers |
Definition at line 82 of file font_scan.c.
References glypharray.
Referenced by ami_open_outline_font().
void ami_font_scan_save | ( | const char * | filename, |
lwc_string ** | glypharray | ||
) |
Save a font glyph cache.
filename | name of cache file to save |
glypharray | an array of 0xffff lwc_string pointers |
Definition at line 425 of file font_scan.c.
References FClose, FOpen, glypharray, and NSLOG.
Referenced by ami_font_savescanner(), and ami_font_scan_init().