NetSurf
Functions
font.c File Reference

HTML internal font handling implementation. More...

#include "utils/nsoption.h"
#include "netsurf/plot_style.h"
#include "css/utils.h"
#include "html/font.h"
Include dependency graph for font.c:

Go to the source code of this file.

Functions

static plot_font_generic_family_t plot_font_generic_family (enum css_font_family_e css)
 Map a generic CSS font family to a generic plot font family. More...
 
static int plot_font_weight (enum css_font_weight_e css)
 Map a CSS font weight to a plot weight value. More...
 
static plot_font_flags_t plot_font_flags (enum css_font_style_e style, enum css_font_variant_e variant)
 Map a CSS font style and font variant to plot font flags. More...
 
void font_plot_style_from_css (const css_unit_ctx *unit_len_ctx, const css_computed_style *css, plot_font_style_t *fstyle)
 Populate a font style using data from a computed CSS style. More...
 

Detailed Description

HTML internal font handling implementation.

Definition in file font.c.

Function Documentation

◆ font_plot_style_from_css()

void font_plot_style_from_css ( const css_unit_ctx *  unit_len_ctx,
const css_computed_style *  css,
struct plot_font_style fstyle 
)

Populate a font style using data from a computed CSS style.

Parameters
unit_len_ctxLength conversion context
cssComputed style to consider
fstyleFont style to populate

Definition at line 135 of file font.c.

References plot_font_style::background, plot_font_style::families, plot_font_style::family, plot_font_style::flags, plot_font_style::foreground, nscss_color_to_ns, nsoption_int, plot_font_flags(), plot_font_generic_family(), plot_font_weight(), PLOT_STYLE_SCALE, plot_font_style::size, and plot_font_style::weight.

Referenced by default_mouse_action(), form_open_select_menu(), html_redraw_file(), html_redraw_text_box(), html_selection_drag_end(), layout_block_context(), layout_line(), layout_lists(), layout_minmax_line(), mouse_action_drag_selection(), and selection_copy_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plot_font_flags()

static plot_font_flags_t plot_font_flags ( enum css_font_style_e  style,
enum css_font_variant_e  variant 
)
static

Map a CSS font style and font variant to plot font flags.

Parameters
styleCSS font style
variantCSS font variant
Returns
Computed plot flags

Definition at line 117 of file font.c.

References FONTF_ITALIC, FONTF_NONE, FONTF_OBLIQUE, and FONTF_SMALLCAPS.

Referenced by font_plot_style_from_css().

Here is the caller graph for this function:

◆ plot_font_generic_family()

static plot_font_generic_family_t plot_font_generic_family ( enum css_font_family_e  css)
static

Map a generic CSS font family to a generic plot font family.

Parameters
cssGeneric CSS font family
Returns
Plot font family

Definition at line 38 of file font.c.

References PLOT_FONT_FAMILY_CURSIVE, PLOT_FONT_FAMILY_FANTASY, PLOT_FONT_FAMILY_MONOSPACE, PLOT_FONT_FAMILY_SANS_SERIF, and PLOT_FONT_FAMILY_SERIF.

Referenced by font_plot_style_from_css().

Here is the caller graph for this function:

◆ plot_font_weight()

static int plot_font_weight ( enum css_font_weight_e  css)
static

Map a CSS font weight to a plot weight value.

Parameters
cssCSS font weight
Returns
Plot weight

Definition at line 70 of file font.c.

Referenced by font_plot_style_from_css().

Here is the caller graph for this function: