Blender V5.0
blf_internal_types.hh File Reference
#include <atomic>
#include <cmath>
#include "DNA_vec_types.h"
#include "BLF_api.hh"
#include "BLI_map.hh"
#include "BLI_mutex.hh"
#include "BLI_vector.hh"
#include "GPU_shader_shared.hh"
#include "GPU_storage_buffer.hh"
#include "GPU_texture.hh"
#include <ft2build.h>

Go to the source code of this file.

Classes

struct  BatchBLF
struct  KerningCacheBLF
struct  GlyphCacheKey
struct  GlyphCacheBLF
struct  GlyphBLF
struct  FontBufInfoBLF
struct  FontMetrics
struct  FontBLF

Namespaces

namespace  blender
namespace  blender::gpu
namespace  blender::ocio

Macros

#define BLF_VARIATIONS_MAX   16
#define MAKE_DVAR_TAG(a, b, c, d)
#define BLF_VARIATION_AXIS_WEIGHT   MAKE_DVAR_TAG('w', 'g', 'h', 't') /* `wght` weight axis. */
#define BLF_VARIATION_AXIS_SLANT   MAKE_DVAR_TAG('s', 'l', 'n', 't') /* `slnt` slant axis. */
#define BLF_VARIATION_AXIS_WIDTH   MAKE_DVAR_TAG('w', 'd', 't', 'h') /* `wdth` width axis. */
#define BLF_VARIATION_AXIS_SPACING   MAKE_DVAR_TAG('s', 'p', 'a', 'c') /* `spac` spacing axis. */
#define BLF_VARIATION_AXIS_OPTSIZE   MAKE_DVAR_TAG('o', 'p', 's', 'z') /* `opsz` optical size. */
#define BLF_BATCH_DRAW_LEN_MAX   128 /* in glyph */
#define KERNING_CACHE_TABLE_SIZE   128
#define KERNING_ENTRY_UNSET   INT_MAX

Variables

BatchBLF g_batch

Sub-Pixel Offset & Utilities

Free-type uses fixed point precision for sub-pixel offsets. Utility functions here avoid exposing the details in the BLF API.

#define FT_PIX_FLOOR(x)
#define FT_PIX_ROUND(x)
#define FT_PIX_CEIL(x)
using ft_pix = int32_t
int ft_pix_to_int (ft_pix v)
int ft_pix_to_int_floor (ft_pix v)
int ft_pix_to_int_ceil (ft_pix v)
ft_pix ft_pix_from_int (int v)
ft_pix ft_pix_from_float (float v)

Macro Definition Documentation

◆ BLF_BATCH_DRAW_LEN_MAX

#define BLF_BATCH_DRAW_LEN_MAX   128 /* in glyph */

Definition at line 103 of file blf_internal_types.hh.

Referenced by blf_texture_draw().

◆ BLF_VARIATION_AXIS_OPTSIZE

#define BLF_VARIATION_AXIS_OPTSIZE   MAKE_DVAR_TAG('o', 'p', 's', 'z') /* `opsz` optical size. */

Definition at line 55 of file blf_internal_types.hh.

Referenced by blf_glyph_set_variation_optical_size().

◆ BLF_VARIATION_AXIS_SLANT

#define BLF_VARIATION_AXIS_SLANT   MAKE_DVAR_TAG('s', 'l', 'n', 't') /* `slnt` slant axis. */

Definition at line 52 of file blf_internal_types.hh.

Referenced by blf_glyph_set_variation_slant().

◆ BLF_VARIATION_AXIS_SPACING

#define BLF_VARIATION_AXIS_SPACING   MAKE_DVAR_TAG('s', 'p', 'a', 'c') /* `spac` spacing axis. */

Definition at line 54 of file blf_internal_types.hh.

Referenced by blf_glyph_set_variation_spacing().

◆ BLF_VARIATION_AXIS_WEIGHT

#define BLF_VARIATION_AXIS_WEIGHT   MAKE_DVAR_TAG('w', 'g', 'h', 't') /* `wght` weight axis. */

◆ BLF_VARIATION_AXIS_WIDTH

#define BLF_VARIATION_AXIS_WIDTH   MAKE_DVAR_TAG('w', 'd', 't', 'h') /* `wdth` width axis. */

Definition at line 53 of file blf_internal_types.hh.

Referenced by blf_glyph_set_variation_width().

◆ BLF_VARIATIONS_MAX

#define BLF_VARIATIONS_MAX   16

Maximum variation axes per font.

Definition at line 46 of file blf_internal_types.hh.

Referenced by blf_glyph_render(), blf_glyph_set_variation_float(), and blf_glyph_set_variation_normalized().

◆ FT_PIX_CEIL

#define FT_PIX_CEIL ( x)
Value:
((x) + 63)

Definition at line 74 of file blf_internal_types.hh.

Referenced by ft_pix_to_int_ceil().

◆ FT_PIX_FLOOR

#define FT_PIX_FLOOR ( x)
Value:
((x) & ~63)

Definition at line 72 of file blf_internal_types.hh.

◆ FT_PIX_ROUND

#define FT_PIX_ROUND ( x)
Value:
FT_PIX_FLOOR((x) + 32)
#define FT_PIX_FLOOR(x)

Definition at line 73 of file blf_internal_types.hh.

Referenced by blf_font_width_to_strlen_glyph_process(), and blf_glyph_from_utf8_and_step().

◆ KERNING_CACHE_TABLE_SIZE

#define KERNING_CACHE_TABLE_SIZE   128

Number of characters in #KerningCacheBLF.table.

Definition at line 106 of file blf_internal_types.hh.

Referenced by blf_kerning(), and blf_setup_face().

◆ KERNING_ENTRY_UNSET

#define KERNING_ENTRY_UNSET   INT_MAX

A value in the kerning cache that indicates it is not yet set.

Definition at line 109 of file blf_internal_types.hh.

Referenced by blf_kerning(), and blf_setup_face().

◆ MAKE_DVAR_TAG

#define MAKE_DVAR_TAG ( a,
b,
c,
d )
Value:
((uint32_t(a) << 24u) | (uint32_t(b) << 16u) | (uint32_t(c) << 8u) | (uint32_t(d)))

Definition at line 48 of file blf_internal_types.hh.

Typedef Documentation

◆ ft_pix

using ft_pix = int32_t

This is an internal type that represents sub-pixel positioning, users of this type are to use ft_pix_* functions to keep scaling/rounding in one place.

Definition at line 68 of file blf_internal_types.hh.

Function Documentation

◆ ft_pix_from_float()

ft_pix ft_pix_from_float ( float v)
inline

Definition at line 96 of file blf_internal_types.hh.

References v.

◆ ft_pix_from_int()

◆ ft_pix_to_int()

◆ ft_pix_to_int_ceil()

int ft_pix_to_int_ceil ( ft_pix v)
inline

Definition at line 86 of file blf_internal_types.hh.

References FT_PIX_CEIL, and v.

Referenced by blf_font_boundbox_ex(), and blf_font_boundbox_foreach_glyph().

◆ ft_pix_to_int_floor()

int ft_pix_to_int_floor ( ft_pix v)
inline

Variable Documentation

◆ g_batch