libcss
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
unit.h File Reference
#include <libcss/types.h>

Go to the source code of this file.

Classes

struct  css_unit_ctx
 

Typedefs

typedef css_fixed(* css_unit_len_measure) (void *pw, const css_computed_style *style, const css_unit unit)
 
typedef struct css_unit_ctx css_unit_ctx
 

Functions

css_fixed css_unit_font_size_len2pt (const css_computed_style *style, const css_unit_ctx *ctx, const css_fixed length, const css_unit unit)
 
css_fixed css_unit_len2css_px (const css_computed_style *style, const css_unit_ctx *ctx, const css_fixed length, const css_unit unit)
 
css_fixed css_unit_len2device_px (const css_computed_style *style, const css_unit_ctx *ctx, const css_fixed length, const css_unit unit)
 

Typedef Documentation

◆ css_unit_ctx

typedef struct css_unit_ctx css_unit_ctx

LibCSS unit conversion context.

The client callback is optional. It is used for measuring "ch" (glyph '0' advance) and "ex" (height of the letter 'x') units. If a NULL pointer is given, LibCSS will use a fixed scaling of the "em" unit.

◆ css_unit_len_measure

typedef css_fixed(* css_unit_len_measure) (void *pw, const css_computed_style *style, const css_unit unit)

Client callback for font measuring.

Parameters
[in]pwClient data.
[in]styleStyle to measure font for, or NULL.
[in]unitEither CSS_UNIT_EX, or CSS_UNIT_CH.
Returns
length in CSS pixels.

Function Documentation

◆ css_unit_font_size_len2pt()

css_fixed css_unit_font_size_len2pt ( const css_computed_style style,
const css_unit_ctx ctx,
const css_fixed  length,
const css_unit  unit 
)

Convert a length to points (pt).

Parameters
[in]styleStyle to perform conversion for or NULL.
[in]ctxLength unit conversion context.
[in]lengthLength to convert.
[in]unitCurrent unit of length.
Returns
A length in points.

◆ css_unit_len2css_px()

css_fixed css_unit_len2css_px ( const css_computed_style style,
const css_unit_ctx ctx,
const css_fixed  length,
const css_unit  unit 
)

Convert a length to CSS pixels.

Parameters
[in]styleStyle to perform conversion for or NULL.
[in]ctxLength unit conversion context.
[in]lengthLength to convert.
[in]unitCurrent unit of length.
Returns
A length in CSS pixels.

◆ css_unit_len2device_px()

css_fixed css_unit_len2device_px ( const css_computed_style style,
const css_unit_ctx ctx,
const css_fixed  length,
const css_unit  unit 
)

Convert a length to device pixels.

Parameters
[in]styleStyle to perform conversion for or NULL.
[in]ctxLength unit conversion context.
[in]lengthLength to convert.
[in]unitCurrent unit of length.
Returns
A length in device pixels.