|
Blender
V2.93
|
#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ft2build.h>#include "MEM_guardedalloc.h"#include "DNA_userdef_types.h"#include "DNA_vec_types.h"#include "BLI_listbase.h"#include "BLI_rect.h"#include "BLI_threads.h"#include "BLF_api.h"#include "GPU_capabilities.h"#include "GPU_immediate.h"#include "blf_internal.h"#include "blf_internal_types.h"#include "BLI_math_vector.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Glyph rendering, texturing and caching. Wraps Freetype and OpenGL functions.
Definition in file blf_glyph.c.
| GlyphBLF* blf_glyph_add | ( | FontBLF * | font, |
| GlyphCacheBLF * | gc, | ||
| unsigned int | index, | ||
| unsigned int | c | ||
| ) |
Definition at line 238 of file blf_glyph.c.
References GlyphBLF::advance, GlyphBLF::advance_i, GlyphBLF::bitmap, BLF_BOLD, blf_glyph_search(), blf_hash(), BLF_HINTING_FULL, BLF_HINTING_NONE, BLF_HINTING_SLIGHT, BLF_ITALIC, BLF_MONOCHROME, BLI_addhead(), BLI_spin_lock(), BLI_spin_unlock(), GlyphBLF::box, GlyphCacheBLF::bucket, GlyphBLF::c, Freestyle::c, GlyphBLF::dims, err, FontBLF::face, FontBLF::flags, float(), FontBLF::ft_lib, FontBLF::ft_lib_mutex, GlyphBLF::idx, MEM_callocN, MEM_mallocN, NULL, GlyphBLF::pitch, GlyphBLF::pos, transform(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by blf_font_ensure_ascii_table(), blf_font_fixed_width(), and blf_kerning_cache_new().
| GlyphCacheBLF* blf_glyph_cache_acquire | ( | FontBLF * | font | ) |
Definition at line 174 of file blf_glyph.c.
References blf_glyph_cache_find(), blf_glyph_cache_new(), BLI_spin_lock(), FontBLF::dpi, FontBLF::glyph_cache_mutex, and FontBLF::size.
Referenced by blf_font_ascender(), blf_font_boundbox(), blf_font_boundbox_foreach_glyph(), blf_font_descender(), blf_font_draw(), blf_font_draw_ascii_ex(), blf_font_draw_buffer(), blf_font_draw_mono(), blf_font_fixed_width(), blf_font_height_max(), blf_font_size(), blf_font_width_max(), blf_font_width_to_rstrlen(), blf_font_width_to_strlen(), and blf_font_wrap_apply().
| void blf_glyph_cache_clear | ( | FontBLF * | font | ) |
Definition at line 192 of file blf_glyph.c.
References blf_glyph_cache_free(), BLI_pophead(), BLI_spin_lock(), BLI_spin_unlock(), FontBLF::cache, and FontBLF::glyph_cache_mutex.
Referenced by BLF_cache_clear().
| GlyphCacheBLF* blf_glyph_cache_find | ( | FontBLF * | font, |
| unsigned int | size, | ||
| unsigned int | dpi | ||
| ) |
Definition at line 116 of file blf_glyph.c.
References BLF_BOLD, BLF_ITALIC, GlyphCacheBLF::bold, FontBLF::cache, GlyphCacheBLF::dpi, ListBase::first, FontBLF::flags, GlyphCacheBLF::italic, GlyphCacheBLF::next, NULL, size(), and GlyphCacheBLF::size.
Referenced by blf_font_size(), blf_glyph_cache_acquire(), and BLF_thumb_preview().
| void blf_glyph_cache_free | ( | GlyphCacheBLF * | gc | ) |
Definition at line 205 of file blf_glyph.c.
References ARRAY_SIZE, GlyphCacheBLF::bitmap_result, blf_glyph_free(), BLI_pophead(), GlyphCacheBLF::bucket, GPU_texture_free(), MEM_freeN, and GlyphCacheBLF::texture.
Referenced by blf_font_free(), and blf_glyph_cache_clear().
| GlyphCacheBLF* blf_glyph_cache_new | ( | FontBLF * | font | ) |
Definition at line 132 of file blf_glyph.c.
References GlyphCacheBLF::ascender, BLF_BOLD, BLF_ITALIC, BLI_addhead(), GlyphCacheBLF::bold, GlyphCacheBLF::bucket, FontBLF::cache, CLAMP_MIN, GlyphCacheBLF::descender, GlyphCacheBLF::dpi, FontBLF::dpi, FontBLF::face, FontBLF::flags, float(), GlyphCacheBLF::glyph_ascii_table, GlyphCacheBLF::glyph_height_max, GlyphCacheBLF::glyph_width_max, GlyphCacheBLF::glyphs_len_free, GlyphCacheBLF::glyphs_len_max, GlyphCacheBLF::italic, MEM_callocN, GlyphCacheBLF::next, NULL, GlyphCacheBLF::prev, GlyphCacheBLF::size, and FontBLF::size.
Referenced by blf_font_size(), and blf_glyph_cache_acquire().
| void blf_glyph_cache_release | ( | FontBLF * | font | ) |
Definition at line 187 of file blf_glyph.c.
References BLI_spin_unlock(), and FontBLF::glyph_cache_mutex.
Referenced by blf_font_ascender(), blf_font_boundbox(), blf_font_boundbox_foreach_glyph(), blf_font_descender(), blf_font_draw(), blf_font_draw_ascii_ex(), blf_font_draw_buffer(), blf_font_draw_mono(), blf_font_fixed_width(), blf_font_height_max(), blf_font_size(), blf_font_width_max(), blf_font_width_to_rstrlen(), blf_font_width_to_strlen(), and blf_font_wrap_apply().
Definition at line 458 of file blf_glyph.c.
References GlyphBLF::dims, float(), floorf, GlyphBLF::pos, x, rctf::xmax, rctf::xmin, y, rctf::ymax, and rctf::ymin.
Referenced by blf_glyph_calc_rect_shadow(), and blf_glyph_render().
|
static |
Definition at line 477 of file blf_glyph.c.
References blf_glyph_calc_rect(), FontBLF::shadow_x, FontBLF::shadow_y, x, and y.
Referenced by blf_glyph_render().
Definition at line 466 of file blf_glyph.c.
References GlyphBLF::advance, GlyphBLF::dims, float(), floorf, MIN2, x, rctf::xmax, rctf::xmin, y, rctf::ymax, and rctf::ymin.
Referenced by blf_glyph_render().
| void blf_glyph_free | ( | GlyphBLF * | g | ) |
Definition at line 392 of file blf_glyph.c.
References GlyphBLF::bitmap, and MEM_freeN.
Referenced by blf_glyph_cache_free().
| void blf_glyph_render | ( | FontBLF * | font, |
| GlyphCacheBLF * | gc, | ||
| GlyphBLF * | g, | ||
| float | x, | ||
| float | y | ||
| ) |
Definition at line 482 of file blf_glyph.c.
References GlyphBLF::bitmap, GlyphCacheBLF::bitmap_len, GlyphCacheBLF::bitmap_len_alloc, GlyphCacheBLF::bitmap_len_landed, GlyphCacheBLF::bitmap_result, blf_batch_draw(), BLF_CLIPPING, blf_glyph_calc_rect(), blf_glyph_calc_rect_shadow(), blf_glyph_calc_rect_test(), BLF_SHADOW, blf_texture3_draw(), blf_texture5_draw(), blf_texture_draw(), BLI_rctf_inside_rctf(), BLI_rctf_translate(), FontBLF::clip_rec, FontBLF::color, GlyphBLF::dims, FontBLF::flags, g_batch, BatchBLF::glyph_cache, GlyphBLF::glyph_cache, GlyphCacheBLF::glyphs_len_free, GPU_max_texture_size(), GPU_R8, GPU_texture_create_2d(), GPU_texture_free(), MEM_reallocN, NULL, GlyphBLF::offset, FontBLF::pos, FontBLF::shadow, FontBLF::shadow_color, FontBLF::tex_size_max, GlyphCacheBLF::texture, w(), x, rctf::xmax, rctf::xmin, y, rctf::ymax, and rctf::ymin.
Referenced by blf_font_draw_ascii_ex(), blf_font_draw_ex(), and blf_font_draw_mono().
| GlyphBLF* blf_glyph_search | ( | GlyphCacheBLF * | gc, |
| unsigned int | c | ||
| ) |
Definition at line 222 of file blf_glyph.c.
References blf_hash(), GlyphCacheBLF::bucket, GlyphBLF::c, Freestyle::c, ListBase::first, GlyphBLF::next, and NULL.
Referenced by blf_font_ensure_ascii_table(), blf_font_fixed_width(), blf_glyph_add(), and blf_kerning_cache_new().
| void blf_kerning_cache_clear | ( | FontBLF * | font | ) |
Definition at line 110 of file blf_glyph.c.
References BLI_freelistN(), FontBLF::kerning_cache, FontBLF::kerning_caches, and NULL.
Referenced by BLF_cache_clear(), and blf_font_free().
| KerningCacheBLF* blf_kerning_cache_find | ( | FontBLF * | font | ) |
Definition at line 58 of file blf_glyph.c.
References ListBase::first, FontBLF::kerning_caches, FontBLF::kerning_mode, KerningCacheBLF::mode, KerningCacheBLF::next, and NULL.
Referenced by blf_font_ensure_ascii_kerning().
| KerningCacheBLF* blf_kerning_cache_new | ( | FontBLF * | font, |
| GlyphCacheBLF * | gc | ||
| ) |
Definition at line 73 of file blf_glyph.c.
References blf_glyph_add(), blf_glyph_search(), BLI_addhead(), FontBLF::face, GlyphBLF::idx, FontBLF::kerning_caches, FontBLF::kerning_mode, MEM_callocN, KerningCacheBLF::mode, KerningCacheBLF::next, NULL, KerningCacheBLF::prev, and KerningCacheBLF::table.
Referenced by blf_font_ensure_ascii_kerning().
|
static |
Definition at line 442 of file blf_glyph.c.
References blf_texture_draw(), x2, and y1.
Referenced by blf_glyph_render().
|
static |
Definition at line 426 of file blf_glyph.c.
References blf_texture_draw(), x2, and y1.
Referenced by blf_glyph_render().
|
static |
Definition at line 400 of file blf_glyph.c.
References blf_batch_draw(), BLF_BATCH_DRAW_LEN_MAX, copy_v2_v2_int(), copy_v4_fl4(), copy_v4_v4_uchar(), g_batch, BatchBLF::glyph_len, BatchBLF::glyph_size_step, GPU_vertbuf_raw_step(), BatchBLF::ofs, x2, and y1.
Referenced by blf_glyph_render(), blf_texture3_draw(), and blf_texture5_draw().