NetSurf
|
Amiga font handling implementation. More...
#include "amiga/os3support.h"
#include <stdlib.h>
#include <proto/bullet.h>
#include <proto/diskfont.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/utility.h>
#include <diskfont/diskfonttag.h>
#include <diskfont/oterrors.h>
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/font.h"
#include "amiga/font_bullet.h"
#include "amiga/font_cache.h"
#include "amiga/font_scan.h"
Go to the source code of this file.
Macros | |
#define | NSA_UNICODE_FONT PLOT_FONT_FAMILY_COUNT |
#define | NSA_NORMAL 0 |
#define | NSA_ITALIC 1 |
#define | NSA_BOLD 2 |
#define | NSA_BOLDITALIC 3 |
#define | NSA_OBLIQUE 4 |
#define | NSA_BOLDOBLIQUE 6 |
#define | NSA_VALUE_BOLDX (1 << 12) |
#define | NSA_VALUE_BOLDY 0 |
#define | NSA_VALUE_SHEARSIN (1 << 14) |
#define | NSA_VALUE_SHEARCOS (1 << 16) |
#define | NSA_FONT_EMWIDTH(s) (s / PLOT_STYLE_SCALE) * (ami_font_dpi_get_xdpi() / 72.0) |
Functions | |
static int32 | ami_font_plot_glyph (struct OutlineFont *ofont, struct RastPort *rp, uint16 *restrict char1, uint16 *restrict char2, uint32 x, uint32 y, uint32 emwidth, bool aa) |
static int32 | ami_font_width_glyph (struct OutlineFont *ofont, const uint16 *restrict char1, const uint16 *restrict char2, uint32 emwidth) |
static struct OutlineFont * | ami_open_outline_font (const plot_font_style_t *fstyle, const uint16 *codepoint) |
Open an outline font in the specified size and style. More... | |
static ULONG | ami_font_unicode_width (const char *string, ULONG length, const plot_font_style_t *fstyle, ULONG x, ULONG y, bool aa) |
static int | amiga_nsfont_utf16_char_length (const uint16 *char1) |
static uint32 | amiga_nsfont_decode_surrogate (const uint16 *char1) |
static nserror | amiga_nsfont_width (const plot_font_style_t *fstyle, const char *string, size_t length, int *width) |
static nserror | amiga_nsfont_position_in_string (const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) |
Find the position in a string where an x coordinate falls. More... | |
static nserror | amiga_nsfont_split (const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) |
Find where to split a string to make it fit a width. More... | |
static struct ami_font_cache_node * | ami_font_open (const char *font, bool critical) |
Search for a font in the list and load from disk if not present. More... | |
static const uint16 * | ami_font_translate_smallcaps (uint16 *utf16char) |
static ULONG | amiga_nsfont_text (struct RastPort *rp, const char *string, ULONG length, const plot_font_style_t *fstyle, ULONG dx, ULONG dy, bool aa) |
void | ami_font_bullet_close (void *nso) |
void | ami_font_bullet_init (void) |
void | ami_font_bullet_fini (void) |
void | ami_font_initscanner (bool force, bool save) |
void | ami_font_finiscanner (void) |
void | ami_font_savescanner (void) |
Variables | |
const uint16 | sc_table [] |
static lwc_string * | glypharray [0xffff+1] |
static struct List | ami_diskfontlib_list |
const struct ami_font_functions | ami_font_bullet_table |
Amiga font handling implementation.
Definition in file font_bullet.c.
#define NSA_BOLD 2 |
Definition at line 56 of file font_bullet.c.
#define NSA_BOLDITALIC 3 |
Definition at line 57 of file font_bullet.c.
#define NSA_BOLDOBLIQUE 6 |
Definition at line 59 of file font_bullet.c.
#define NSA_FONT_EMWIDTH | ( | s | ) | (s / PLOT_STYLE_SCALE) * (ami_font_dpi_get_xdpi() / 72.0) |
Definition at line 66 of file font_bullet.c.
#define NSA_ITALIC 1 |
Definition at line 55 of file font_bullet.c.
#define NSA_NORMAL 0 |
Definition at line 54 of file font_bullet.c.
#define NSA_OBLIQUE 4 |
Definition at line 58 of file font_bullet.c.
#define NSA_UNICODE_FONT PLOT_FONT_FAMILY_COUNT |
Definition at line 52 of file font_bullet.c.
#define NSA_VALUE_BOLDX (1 << 12) |
Definition at line 61 of file font_bullet.c.
#define NSA_VALUE_BOLDY 0 |
Definition at line 62 of file font_bullet.c.
#define NSA_VALUE_SHEARCOS (1 << 16) |
Definition at line 64 of file font_bullet.c.
#define NSA_VALUE_SHEARSIN (1 << 14) |
Definition at line 63 of file font_bullet.c.
void ami_font_bullet_close | ( | void * | nso | ) |
Definition at line 872 of file font_bullet.c.
References ami_diskfontlib_list, CloseOutlineFont(), and ami_font_cache_node::font.
Referenced by ami_font_cache_insert().
void ami_font_bullet_fini | ( | void | ) |
Definition at line 900 of file font_bullet.c.
References ami_font_cache_fini(), and ami_font_finiscanner().
Referenced by ami_font_fini().
void ami_font_bullet_init | ( | void | ) |
Definition at line 885 of file font_bullet.c.
References ami_diskfontlib_list, ami_font_bullet_table, ami_font_cache_init(), ami_font_initscanner(), and ami_nsfont.
Referenced by ami_font_init().
void ami_font_finiscanner | ( | void | ) |
Definition at line 912 of file font_bullet.c.
References ami_font_scan_fini(), and glypharray.
Referenced by ami_font_bullet_fini(), and ami_gui_opts_use().
void ami_font_initscanner | ( | bool | force, |
bool | save | ||
) |
Definition at line 907 of file font_bullet.c.
References ami_font_scan_init(), glypharray, and nsoption_charp.
Referenced by ami_font_bullet_init(), and ami_gui_opts_use().
|
static |
Search for a font in the list and load from disk if not present.
Definition at line 350 of file font_bullet.c.
References ami_diskfontlib_list, ami_font_cache_alloc_entry(), ami_font_cache_insert(), ami_font_cache_locate(), amiga_warn_user(), ami_font_cache_node::bold, ami_font_cache_node::bolditalic, ami_font_cache_node::font, ami_font_cache_node::italic, NSLOG, OFF_OPEN, OutlineFont::olf_OTagList, and OpenOutlineFont().
Referenced by ami_open_outline_font().
|
inlinestatic |
Definition at line 547 of file font_bullet.c.
References ami_memory_chip_alloc, ami_memory_chip_free, AMI_OFONT_ENGINE, amiga_nsfont_decode_surrogate(), OutlineFont::BulletBase, EObtainInfo, EReleaseInfo, and ESetInfo.
Referenced by amiga_nsfont_text().
void ami_font_savescanner | ( | void | ) |
Definition at line 917 of file font_bullet.c.
References ami_font_scan_save(), glypharray, and nsoption_charp.
Referenced by ami_gui_opts_use().
Definition at line 731 of file font_bullet.c.
References sc_table.
Referenced by ami_font_unicode_width(), and amiga_nsfont_text().
|
inlinestatic |
Definition at line 810 of file font_bullet.c.
References ami_font_translate_smallcaps(), ami_font_width_glyph(), ami_open_outline_font(), amiga_nsfont_utf16_char_length(), plot_font_style::flags, FONTF_SMALLCAPS, NSA_FONT_EMWIDTH, NSERROR_OK, plot_font_style::size, and utf8_to_enc().
Referenced by amiga_nsfont_width().
|
inlinestatic |
Definition at line 658 of file font_bullet.c.
References AMI_OFONT_ENGINE, amiga_nsfont_decode_surrogate(), OutlineFont::BulletBase, EObtainInfo, EReleaseInfo, ESetInfo, and GetHead().
Referenced by ami_font_unicode_width(), amiga_nsfont_position_in_string(), and amiga_nsfont_split().
|
static |
Open an outline font in the specified size and style.
fstyle | font style structure |
codepoint | open a default font instead of the one specified by fstyle |
Definition at line 413 of file font_bullet.c.
References ami_font_dpi_get_devicedpi(), ami_font_open(), ami_font_scan_lookup(), AMI_OFONT_ENGINE, amiga_nsfont_utf16_char_length(), ami_font_cache_node::bold, ami_font_cache_node::bolditalic, OutlineFont::BulletBase, ESetInfo, plot_font_style::family, plot_font_style::flags, ami_font_cache_node::font, FONTF_ITALIC, FONTF_OBLIQUE, glypharray, ami_font_cache_node::italic, NSA_BOLD, NSA_BOLDITALIC, NSA_BOLDOBLIQUE, NSA_ITALIC, NSA_OBLIQUE, NSA_UNICODE_FONT, NSA_VALUE_BOLDX, NSA_VALUE_BOLDY, NSA_VALUE_SHEARCOS, NSA_VALUE_SHEARSIN, nsoption_charp, PLOT_FONT_FAMILY_CURSIVE, PLOT_FONT_FAMILY_FANTASY, PLOT_FONT_FAMILY_MONOSPACE, PLOT_FONT_FAMILY_SANS_SERIF, PLOT_FONT_FAMILY_SERIF, PLOT_STYLE_SCALE, plot_font_style::size, and plot_font_style::weight.
Referenced by ami_font_unicode_width(), amiga_nsfont_position_in_string(), amiga_nsfont_split(), and amiga_nsfont_text().
Definition at line 157 of file font_bullet.c.
References amiga_nsfont_utf16_char_length().
Referenced by ami_font_plot_glyph(), and ami_font_width_glyph().
|
static |
Find the position in a string where an x coordinate falls.
fstyle | style for this text |
string | UTF-8 string to measure |
length | length of string |
x | x coordinate to search for |
char_offset | updated to offset in string of actual_x, [0..length] |
actual_x | updated to x coordinate of character closest to x |
Definition at line 191 of file font_bullet.c.
References ami_font_width_glyph(), ami_open_outline_font(), amiga_nsfont_utf16_char_length(), NSA_FONT_EMWIDTH, NSERROR_INVALID, NSERROR_OK, plot_font_style::size, utf8_next(), and utf8_to_enc().
|
static |
Find where to split a string to make it fit a width.
fstyle | style for this text |
string | UTF-8 string to measure |
length | length of string |
x | width available |
char_offset | updated to offset in string of actual_x, [1..length] |
actual_x | updated to x coordinate of character closest to x |
On exit, char_offset indicates first character after split point.
Note: char_offset of 0 should never be returned.
Returns: char_offset giving split point closest to x, where actual_x <= x else char_offset giving split point closest to x, where actual_x > x
Returning char_offset == length means no split possible
Definition at line 274 of file font_bullet.c.
References ami_font_width_glyph(), ami_open_outline_font(), NSA_FONT_EMWIDTH, NSERROR_INVALID, NSERROR_OK, plot_font_style::size, utf8_next(), and utf8_to_enc().
|
static |
Definition at line 745 of file font_bullet.c.
References ami_font_plot_glyph(), ami_font_translate_smallcaps(), ami_open_outline_font(), amiga_nsfont_utf16_char_length(), plot_font_style::flags, FONTF_SMALLCAPS, NSA_FONT_EMWIDTH, NSERROR_OK, plot_font_style::size, and utf8_to_enc().
|
inlinestatic |
Definition at line 148 of file font_bullet.c.
Referenced by ami_font_unicode_width(), ami_open_outline_font(), amiga_nsfont_decode_surrogate(), amiga_nsfont_position_in_string(), and amiga_nsfont_text().
|
static |
Definition at line 166 of file font_bullet.c.
References ami_font_unicode_width(), NSERROR_OK, and width.
|
static |
Definition at line 137 of file font_bullet.c.
Referenced by ami_font_bullet_close(), ami_font_bullet_init(), and ami_font_open().
const struct ami_font_functions ami_font_bullet_table |
Definition at line 878 of file font_bullet.c.
Referenced by ami_font_bullet_init().
|
static |
Definition at line 135 of file font_bullet.c.
Referenced by ami_font_finiscanner(), ami_font_initscanner(), ami_font_savescanner(), ami_font_scan_fini(), ami_font_scan_font(), ami_font_scan_fonts(), ami_font_scan_init(), ami_font_scan_load(), ami_font_scan_lookup(), ami_font_scan_save(), and ami_open_outline_font().
const uint16 sc_table[] |
Definition at line 68 of file font_bullet.c.
Referenced by ami_font_translate_smallcaps().