NetSurf
|
#include <assert.h>
#include <ft2build.h>
#include "netsurf/inttypes.h"
#include "utils/filepath.h"
#include "utils/utf8.h"
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/utf8.h"
#include "netsurf/layout.h"
#include "netsurf/browser.h"
#include "netsurf/plot_style.h"
#include "framebuffer/gui.h"
#include "framebuffer/font.h"
#include "framebuffer/findfile.h"
Go to the source code of this file.
Data Structures | |
struct | fb_faceid_s |
Macros | |
#define | CACHE_MIN_SIZE (100 * 1024) |
#define | BOLD_WEIGHT 700 |
#define | FB_FACE_DEFAULT 0 |
Typedefs | |
typedef struct fb_faceid_s | fb_faceid_t |
Enumerations | |
enum | fb_face_e { FB_FACE_SANS_SERIF = 0 , FB_FACE_SANS_SERIF_BOLD , FB_FACE_SANS_SERIF_ITALIC , FB_FACE_SANS_SERIF_ITALIC_BOLD , FB_FACE_SERIF , FB_FACE_SERIF_BOLD , FB_FACE_MONOSPACE , FB_FACE_MONOSPACE_BOLD , FB_FACE_CURSIVE , FB_FACE_FANTASY , FB_FACE_COUNT } |
Functions | |
static FT_Error | ft_face_requester (FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face *face) |
map cache manager handle to face id More... | |
static fb_faceid_t * | fb_new_face (const char *option, const char *resname, const char *fontname) |
create new framebuffer face and cause it to be loaded to check its ok More... | |
bool | fb_font_init (void) |
Initialise framebuffer font handling. More... | |
bool | fb_font_finalise (void) |
Finalise framebuffer font handling. More... | |
static void | fb_fill_scalar (const plot_font_style_t *fstyle, FTC_Scaler srec) |
fill freetype scalar More... | |
FT_Glyph | fb_getglyph (const plot_font_style_t *fstyle, uint32_t ucs4) |
nserror | fb_font_width (const plot_font_style_t *fstyle, const char *string, size_t length, int *width) |
nserror | fb_font_position (const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) |
static nserror | fb_font_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... | |
Variables | |
static FT_Library | library |
static FTC_Manager | ft_cmanager |
static FTC_CMapCache | ft_cmap_cache |
static FTC_ImageCache | ft_image_cache |
int | ft_load_type |
static fb_faceid_t * | fb_faces [FB_FACE_COUNT] |
static struct gui_layout_table | layout_table |
struct gui_layout_table * | framebuffer_layout_table = &layout_table |
struct gui_utf8_table * | framebuffer_utf8_table = NULL |
#define BOLD_WEIGHT 700 |
Definition at line 42 of file font_freetype.c.
#define CACHE_MIN_SIZE (100 * 1024) |
Definition at line 40 of file font_freetype.c.
#define FB_FACE_DEFAULT 0 |
Definition at line 74 of file font_freetype.c.
typedef struct fb_faceid_s fb_faceid_t |
enum fb_face_e |
Definition at line 59 of file font_freetype.c.
|
static |
fill freetype scalar
Definition at line 345 of file font_freetype.c.
References BOLD_WEIGHT, browser_get_dpi(), plot_font_style::family, FB_FACE_CURSIVE, FB_FACE_DEFAULT, FB_FACE_FANTASY, FB_FACE_MONOSPACE, FB_FACE_MONOSPACE_BOLD, FB_FACE_SANS_SERIF, FB_FACE_SANS_SERIF_BOLD, FB_FACE_SANS_SERIF_ITALIC, FB_FACE_SANS_SERIF_ITALIC_BOLD, FB_FACE_SERIF, FB_FACE_SERIF_BOLD, fb_faces, plot_font_style::flags, FONTF_ITALIC, FONTF_OBLIQUE, 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 fb_getglyph().
bool fb_font_finalise | ( | void | ) |
Finalise framebuffer font handling.
Definition at line 316 of file font_freetype.c.
bool fb_font_init | ( | void | ) |
Initialise framebuffer font handling.
Definition at line 147 of file font_freetype.c.
nserror fb_font_position | ( | const plot_font_style_t * | fstyle, |
const char * | string, | ||
size_t | length, | ||
int | x, | ||
size_t * | char_offset, | ||
int * | actual_x | ||
) |
Definition at line 459 of file font_freetype.c.
References fb_getglyph(), NSERROR_OK, utf8_next(), and utf8_to_ucs4().
|
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, in bytes |
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 516 of file font_freetype.c.
References fb_getglyph(), NSERROR_OK, utf8_next(), and utf8_to_ucs4().
nserror fb_font_width | ( | const plot_font_style_t * | fstyle, |
const char * | string, | ||
size_t | length, | ||
int * | width | ||
) |
Definition at line 434 of file font_freetype.c.
References fb_getglyph(), NSERROR_OK, utf8_next(), utf8_to_ucs4(), and width.
FT_Glyph fb_getglyph | ( | const plot_font_style_t * | fstyle, |
uint32_t | ucs4 | ||
) |
Definition at line 402 of file font_freetype.c.
References fb_faceid_s::cidx, fb_fill_scalar(), ft_cmap_cache, ft_image_cache, and ft_load_type.
Referenced by fb_font_position(), fb_font_split(), and fb_font_width().
|
static |
create new framebuffer face and cause it to be loaded to check its ok
Definition at line 118 of file font_freetype.c.
References filepath_sfind(), fb_faceid_s::fontfile, ft_cmanager, NSLOG, PATH_MAX, and respaths.
Referenced by fb_font_init().
|
static |
map cache manager handle to face id
Definition at line 82 of file font_freetype.c.
References fb_faceid_s::cidx, fb_faceid_s::fontfile, fb_faceid_s::index, library, and NSLOG.
Referenced by fb_font_init().
|
static |
Definition at line 76 of file font_freetype.c.
Referenced by fb_fill_scalar(), fb_font_finalise(), and fb_font_init().
struct gui_layout_table* framebuffer_layout_table = &layout_table |
Definition at line 562 of file font_freetype.c.
struct gui_utf8_table* framebuffer_utf8_table = NULL |
Definition at line 565 of file font_freetype.c.
|
static |
Definition at line 45 of file font_freetype.c.
Referenced by fb_font_finalise(), fb_font_init(), and fb_new_face().
|
static |
Definition at line 46 of file font_freetype.c.
Referenced by fb_font_init(), and fb_getglyph().
|
static |
Definition at line 47 of file font_freetype.c.
Referenced by fb_font_init(), and fb_getglyph().
int ft_load_type |
Definition at line 49 of file font_freetype.c.
Referenced by fb_font_init(), and fb_getglyph().
|
static |
Definition at line 556 of file font_freetype.c.
|
static |
Definition at line 44 of file font_freetype.c.
Referenced by fb_font_finalise(), fb_font_init(), and ft_face_requester().