|
Blender V5.0
|
#include <algorithm>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <ft2build.h>#include "MEM_guardedalloc.h"#include "BLI_listbase.h"#include "BLI_math_color.h"#include "BLI_math_geom.h"#include "BLI_rect.h"#include "BLF_api.hh"#include "DNA_curve_types.h"#include "GPU_capabilities.hh"#include "blf_internal.hh"#include "blf_internal_types.hh"#include "BLI_math_vector.h"#include "BLI_string_utf8.h"#include "nanosvgrast.h"#include "svg_icons.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Classes | |
| struct | UnicodeBlock |
Macros | |
| #define | BLF_GAMMA_CORRECT_GLYPHS |
Functions | |
Internal Utilities | |
| static FT_Fixed | to_16dot16 (const double val) |
| static float | from_16dot16 (const FT_Fixed value) |
Glyph Cache | |
| static GlyphCacheBLF * | blf_glyph_cache_find (const FontBLF *font) |
| static GlyphCacheBLF * | blf_glyph_cache_new (FontBLF *font) |
| GlyphCacheBLF * | blf_glyph_cache_acquire (FontBLF *font) |
| void | blf_glyph_cache_release (FontBLF *font) |
| void | blf_glyph_cache_clear (FontBLF *font) |
| static GlyphBLF * | blf_glyph_cache_find_glyph (const GlyphCacheBLF *gc, const uint charcode, const uint8_t subpixel) |
| static uchar | blf_glyph_gamma (const uchar c) |
| static GlyphBLF * | blf_glyph_cache_add_glyph (GlyphCacheBLF *gc, const FT_GlyphSlot glyph, const uint charcode, const FT_UInt glyph_index, const uint8_t subpixel) |
| static GlyphBLF * | blf_glyph_cache_add_blank (GlyphCacheBLF *gc, const uint charcode) |
| static GlyphBLF * | blf_glyph_cache_add_svg (GlyphCacheBLF *gc, const uint charcode, const bool color, blender::FunctionRef< void(std::string &)> edit_source_cb=nullptr) |
Glyph Load | |
| static FT_GlyphSlot | blf_glyph_load (FontBLF *font, const FT_UInt glyph_index, const bool outline_only) |
Glyph Render | |
| static bool | blf_glyph_render_bitmap (FontBLF *font, FT_GlyphSlot glyph) |
Variations (Multiple Masters) support | |
| static const FT_Var_Axis * | blf_var_axis_by_tag (const FT_MM_Var *variations, const uint32_t tag, int *r_axis_index) |
| static FT_Fixed | blf_factor_to_coordinate (const FT_Var_Axis *axis, const float factor) |
| static bool | blf_glyph_set_variation_normalized (const FontBLF *font, FT_Fixed coords[], const uint32_t tag, const float factor) |
| static bool | blf_glyph_set_variation_float (const FontBLF *font, FT_Fixed coords[], uint32_t tag, float *value) |
| static float | blf_glyph_set_variation_weight (const FontBLF *font, FT_Fixed coords[], float current_weight, float target_weight) |
| static float | blf_glyph_set_variation_slant (const FontBLF *font, FT_Fixed coords[], float current_degrees, float target_degrees) |
| static float | blf_glyph_set_variation_width (const FontBLF *font, FT_Fixed coords[], float current_width, float target_width) |
| static float | blf_glyph_set_variation_spacing (const FontBLF *font, FT_Fixed coords[], float current_spacing, float target_spacing) |
| static bool | blf_glyph_set_variation_optical_size (const FontBLF *font, FT_Fixed coords[], const float points) |
Glyph Transformations | |
| static bool | blf_glyph_transform_weight (FT_GlyphSlot glyph, float width, bool monospaced) |
| static bool | blf_glyph_transform_slant (FT_GlyphSlot glyph, float degrees) |
| static bool | blf_glyph_transform_width (FT_GlyphSlot glyph, float factor) |
| static bool | blf_glyph_transform_spacing (FT_GlyphSlot glyph, float factor) |
| static bool | blf_glyph_transform_monospace (FT_GlyphSlot glyph, int width) |
Glyph Access (Ensure/Free) | |
| static FT_GlyphSlot | blf_glyph_render (FontBLF *settings_font, FontBLF *glyph_font, FT_UInt glyph_index, uint charcode, uint8_t subpixel, int fixed_width, bool outline_only) |
| GlyphBLF * | blf_glyph_ensure (FontBLF *font, GlyphCacheBLF *gc, const uint charcode, uint8_t subpixel) |
| GlyphBLF * | blf_glyph_ensure_icon (GlyphCacheBLF *gc, const uint icon_id, bool color, blender::FunctionRef< void(std::string &)> edit_source_cb) |
| GlyphBLF * | blf_glyph_ensure_subpixel (FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x) |
Glyph Bounds Calculation | |
| static void | blf_glyph_calc_rect (const GlyphBLF *g, const int x, const int y, rcti *r_rect) |
| static void | blf_glyph_calc_rect_test (const GlyphBLF *g, const int x, const int y, rcti *r_rect) |
| static void | blf_glyph_calc_rect_shadow (const GlyphBLF *g, const int x, const int y, const FontBLF *font, rcti *r_rect) |
Glyph Drawing | |
| static void | blf_texture_draw (const GlyphBLF *g, const uchar color[4], const FontShadowType shadow, const int x1, const int y1, const int x2, const int y2) |
| void | blf_glyph_draw (FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, const int x, const int y) |
Convert Glyph to Curves | |
| static void | blf_glyph_to_curves (const FT_Outline &ftoutline, ListBase *nurbsbase, const float scale) |
| static FT_GlyphSlot | blf_glyphslot_ensure_outline (FontBLF *font, uint charcode, bool use_fallback) |
| bool | blf_character_to_curves (FontBLF *font, uint unicode, ListBase *nurbsbase, const float scale, bool use_fallback, float *r_advance) |
Glyph Unicode Block Lookup | |
This table can be used to find a coverage bit based on a charcode. Later we can get default language and script from codepoint. | |
| static const UnicodeBlock | unicode_blocks [] |
| static const UnicodeBlock * | blf_charcode_to_unicode_block (const uint charcode) |
| static int | blf_charcode_to_coverage_bit (const uint charcode) |
| static bool | blf_font_has_coverage_bit (const FontBLF *font, const int coverage_bit) |
| static FT_UInt | blf_glyph_index_from_charcode (FontBLF **font, const uint charcode) |
Glyph rendering, texturing and caching. Wraps Freetype and OpenGL functions.
Definition in file blf_glyph.cc.
| #define BLF_GAMMA_CORRECT_GLYPHS |
Convert glyph coverage amounts to lightness values. Uses a LUT that perceptually improves anti-aliasing and results in text that looks a bit fuller and slightly brighter. This should be reconsidered in some - or all - cases when we transform the entire UI.
Definition at line 58 of file blf_glyph.cc.
| bool blf_character_to_curves | ( | FontBLF * | font, |
| unsigned int | unicode, | ||
| ListBase * | nurbsbase, | ||
| const float | scale, | ||
| bool | use_fallback, | ||
| float * | r_advance ) |
Convert a character's outlines into curves.
Definition at line 1887 of file blf_glyph.cc.
References blf_glyph_to_curves(), blf_glyphslot_ensure_outline(), and float.
Referenced by BLF_character_to_curves().
|
static |
Definition at line 757 of file blf_glyph.cc.
References blf_charcode_to_unicode_block(), and UnicodeBlock::coverage_bit.
Referenced by blf_glyph_index_from_charcode().
|
static |
Find a unicode block that a charcode belongs to.
Definition at line 725 of file blf_glyph.cc.
References ARRAY_SIZE, max, min, and unicode_blocks.
Referenced by blf_charcode_to_coverage_bit().
|
static |
Convert a float factor to a fixed-point design coordinate. Currently unused because we are only dealing with known axes with specific functions, but this would be needed for unregistered, custom, or private tags. These are all uppercase axis tags.
| axis | Pointer to a design space axis structure. |
| factor | -1 to 1 with 0 meaning "default" |
Definition at line 972 of file blf_glyph.cc.
Referenced by blf_glyph_set_variation_normalized().
|
static |
Definition at line 774 of file blf_glyph.cc.
References FontBLF::unicode_ranges.
Referenced by blf_glyph_index_from_charcode().
| GlyphCacheBLF * blf_glyph_cache_acquire | ( | FontBLF * | font | ) |
Definition at line 133 of file blf_glyph.cc.
References blf_glyph_cache_find(), blf_glyph_cache_new(), and FontBLF::glyph_cache_mutex.
Referenced by blf_draw_svg_icon(), blf_font_boundbox(), blf_font_boundbox_foreach_glyph(), blf_font_draw(), blf_font_draw_buffer(), blf_font_draw_mono(), blf_font_fixed_width(), blf_font_glyph_advance(), blf_font_width_to_rstrlen(), blf_font_width_to_strlen(), blf_font_wrap_apply(), and blf_svg_icon_bitmap().
|
static |
Definition at line 344 of file blf_glyph.cc.
References Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), GlyphCacheBLF::glyphs, and result.
Referenced by blf_glyph_cache_add_svg().
|
static |
Add a rendered glyph to a cache.
Definition at line 225 of file blf_glyph.cc.
References Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blf_glyph_gamma(), ELEM, GlyphCacheBLF::glyphs, i, MEM_malloc_arrayN(), result, x, and y.
Referenced by blf_glyph_ensure().
|
static |
Definition at line 356 of file blf_glyph.cc.
References Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blf_glyph_cache_add_blank(), BLF_ICON_OFFSET, ceil, blender::Array< T, InlineBufferCapacity, Allocator >::data(), float, GlyphCacheBLF::glyphs, MEM_malloc_arrayN(), result, round, GlyphCacheBLF::size, srgb_to_grayscale_byte(), x, and y.
Referenced by blf_glyph_ensure_icon().
| void blf_glyph_cache_clear | ( | FontBLF * | font | ) |
Definition at line 162 of file blf_glyph.cc.
References FontBLF::cache, Vector< T, InlineBufferCapacity, Allocator >::clear_and_shrink(), FontBLF::glyph_cache_mutex, and lock.
Referenced by BLF_cache_clear(), and blf_font_free().
|
static |
Definition at line 86 of file blf_glyph.cc.
References BLF_BOLD, BLF_ITALIC, FontBLF::cache, FontBLF::char_slant, FontBLF::char_spacing, FontBLF::char_weight, FontBLF::char_width, FontBLF::flags, and FontBLF::size.
Referenced by blf_glyph_cache_acquire().
|
static |
Try to find a glyph in cache.
Definition at line 173 of file blf_glyph.cc.
References GlyphCacheBLF::glyphs, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr_as(), and ptr.
Referenced by blf_glyph_ensure(), and blf_glyph_ensure_icon().
|
static |
Definition at line 100 of file blf_glyph.cc.
References Vector< T, InlineBufferCapacity, Allocator >::append(), BLF_BOLD, blf_ensure_size(), blf_get_char_index(), BLF_ITALIC, FontBLF::cache, FontBLF::char_slant, FontBLF::char_spacing, FontBLF::char_weight, FontBLF::char_width, FontBLF::face, FontBLF::flags, FontBLF::ft_size, Vector< T, InlineBufferCapacity, Allocator >::last(), FontBLF::size, and U.
Referenced by blf_glyph_cache_acquire().
| void blf_glyph_cache_release | ( | FontBLF * | font | ) |
Definition at line 146 of file blf_glyph.cc.
References FontBLF::glyph_cache_mutex.
Referenced by blf_draw_svg_icon(), blf_font_boundbox(), blf_font_boundbox_foreach_glyph(), blf_font_draw(), blf_font_draw_buffer(), blf_font_draw_mono(), blf_font_fixed_width(), blf_font_glyph_advance(), blf_font_width_to_rstrlen(), blf_font_width_to_strlen(), blf_font_wrap_apply(), and blf_svg_icon_bitmap().
Definition at line 1436 of file blf_glyph.cc.
References GlyphBLF::dims, GlyphBLF::pos, x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Referenced by blf_glyph_calc_rect_shadow(), and blf_glyph_draw().
|
static |
Definition at line 1455 of file blf_glyph.cc.
References blf_glyph_calc_rect(), FontBLF::shadow_x, FontBLF::shadow_y, x, and y.
Referenced by blf_glyph_draw().
|
static |
Definition at line 1444 of file blf_glyph.cc.
References abs, GlyphBLF::advance_x, GlyphBLF::dims, ft_pix_to_int(), GlyphBLF::pos, x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Referenced by blf_glyph_draw().
| void blf_glyph_draw | ( | FontBLF * | font, |
| GlyphCacheBLF * | gc, | ||
| GlyphBLF * | g, | ||
| const int | x, | ||
| const int | y ) |
Definition at line 1493 of file blf_glyph.cc.
References FontBLF::aspect, GlyphBLF::bitmap, GlyphCacheBLF::bitmap_len, GlyphCacheBLF::bitmap_len_alloc, GlyphCacheBLF::bitmap_len_landed, GlyphCacheBLF::bitmap_result, BLF_ASPECT, blf_batch_draw(), BLF_CLIPPING, blf_glyph_calc_rect(), blf_glyph_calc_rect_shadow(), blf_glyph_calc_rect_test(), BLF_SHADOW, blf_texture_draw(), BLI_rcti_inside_rcti(), BLI_rcti_translate(), FontBLF::clip_rec, FontBLF::color, GlyphBLF::dims, FontBLF::flags, g_batch, GlyphBLF::glyph_cache, GPU_max_texture_size(), GPU_texture_create_2d(), GPU_texture_free(), GPU_TEXTURE_USAGE_SHADER_READ, MEM_reallocN, None, GlyphBLF::num_channels, GlyphBLF::offset, FontBLF::pos, FontBLF::shadow, FontBLF::shadow_color, FontBLF::tex_size_max, GlyphCacheBLF::texture, w(), x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Referenced by blf_draw_svg_icon(), blf_font_draw_ex(), and blf_font_draw_mono().
| GlyphBLF * blf_glyph_ensure | ( | FontBLF * | font, |
| GlyphCacheBLF * | gc, | ||
| uint | charcode, | ||
| uint8_t | subpixel = 0 ) |
Create (or load from cache) a fully-rendered bitmap glyph.
Definition at line 1345 of file blf_glyph.cc.
References blf_ensure_face(), blf_glyph_cache_add_glyph(), blf_glyph_cache_find_glyph(), blf_glyph_ensure_icon(), blf_glyph_index_from_charcode(), blf_glyph_render(), ELEM, and GlyphCacheBLF::fixed_width.
Referenced by blf_font_glyph_advance(), blf_glyph_ensure_subpixel(), and blf_glyph_from_utf8_and_step().
| GlyphBLF * blf_glyph_ensure_icon | ( | GlyphCacheBLF * | gc, |
| const uint | icon_id, | ||
| bool | color, | ||
| blender::FunctionRef< void(std::string &)> | edit_source_cb ) |
Definition at line 1387 of file blf_glyph.cc.
References blf_glyph_cache_add_svg(), blf_glyph_cache_find_glyph(), and BLF_ICON_OFFSET.
Referenced by blf_draw_svg_icon(), blf_glyph_ensure(), and blf_svg_icon_bitmap().
| GlyphBLF * blf_glyph_ensure_subpixel | ( | FontBLF * | font, |
| GlyphCacheBLF * | gc, | ||
| GlyphBLF * | g, | ||
| int32_t | pen_x ) |
Definition at line 1401 of file blf_glyph.cc.
References GlyphBLF::advance_x, blf_glyph_ensure(), BLF_RENDER_SUBPIXELAA, GlyphBLF::c, GlyphBLF::dims, FontBLF::flags, FontBLF::size, and GlyphBLF::subpixel.
Referenced by blf_font_width_to_strlen_glyph_process(), and blf_glyph_from_utf8_and_step().
Gamma correction of glyph coverage values with widely-recommended gamma of 1.43. "The reasons are historical. Because so many programmers have neglected gamma blending for so long, people who have created fonts have tried to work around the problem of fonts looking too thin by just making the fonts thicker! Obviously it doesn't help the jaggedness, but it does make them look the proper weight, as originally intended. The obvious problem with this is that if we want to gamma blend correctly many older fonts will look wrong. So we compromise, and use a lower gamma value, so we get a bit better anti-aliasing, but the fonts don't look too heavy." https://www.puredevsoftware.com/blog/2019/01/22/sub-pixel-gamma-correct-font-rendering/
Definition at line 198 of file blf_glyph.cc.
Referenced by blf_glyph_cache_add_glyph().
Return a glyph index from charcode. Not found returns zero, which is a valid printable character (.notdef or tofu). Font is allowed to change here.
Definition at line 786 of file blf_glyph.cc.
References BLF_CACHED, blf_charcode_to_coverage_bit(), BLF_DEFAULT, blf_font_has_coverage_bit(), blf_get_char_index(), BLF_LAST_RESORT, BLF_MAX_FONT, BLF_MONOSPACED, BLF_NO_FALLBACK, FontBLF::flags, global_font, and i.
Referenced by blf_glyph_ensure(), and blf_glyphslot_ensure_outline().
|
static |
Load a glyph into the glyph slot of a font's face object.
Definition at line 850 of file blf_glyph.cc.
References BLF_HINTING_FULL, BLF_HINTING_NONE, BLF_HINTING_SLIGHT, BLF_MONOCHROME, FontBLF::face, and FontBLF::flags.
Referenced by blf_glyph_render().
|
static |
Create and return a fully-rendered bitmap glyph.
Definition at line 1256 of file blf_glyph.cc.
References BLF_BOLD, blf_ensure_size(), blf_font_size(), blf_glyph_load(), blf_glyph_render_bitmap(), blf_glyph_set_variation_optical_size(), blf_glyph_set_variation_slant(), blf_glyph_set_variation_spacing(), blf_glyph_set_variation_weight(), blf_glyph_set_variation_width(), blf_glyph_transform_monospace(), blf_glyph_transform_slant(), blf_glyph_transform_spacing(), blf_glyph_transform_weight(), blf_glyph_transform_width(), BLF_ITALIC, BLF_MONOSPACED, BLF_VARIATIONS_MAX, BLI_wcwidth_or_error(), FontBLF::char_slant, FontBLF::char_spacing, FontBLF::char_weight, FontBLF::char_width, col, FontBLF::face, FontBLF::flags, float, FontBLF::metrics, FontBLF::size, FontMetrics::slant, FontMetrics::spacing, FontBLF::variations, FontMetrics::weight, and FontMetrics::width.
Referenced by blf_glyph_ensure(), and blf_glyphslot_ensure_outline().
|
static |
Convert a glyph from outlines to a bitmap that we can display.
Definition at line 898 of file blf_glyph.cc.
References BLF_HINTING_SLIGHT, BLF_MONOCHROME, ELEM, FontBLF::flags, and FontBLF::ft_lib.
Referenced by blf_glyph_render().
|
static |
Set a face variation axis to an exact float value
| coords | Array of design coordinates, per axis. |
| tag | Axis tag, e.g. BLF_VARIATION_AXIS_OPTSIZE. |
| value | New float value. Converted to 16.16 and clamped within allowed range. |
Definition at line 1020 of file blf_glyph.cc.
References blf_var_axis_by_tag(), BLF_VARIATIONS_MAX, CLAMP, from_16dot16(), to_16dot16(), and FontBLF::variations.
Referenced by blf_glyph_set_variation_optical_size(), blf_glyph_set_variation_slant(), blf_glyph_set_variation_spacing(), blf_glyph_set_variation_weight(), and blf_glyph_set_variation_width().
|
static |
Alter a face variation axis by a factor. Currently unused because we are only dealing with known axes with specific functions, but this would be needed for unregistered, custom, or private tags. These are all uppercase axis tags.
| coords | array of design coordinates, per axis. |
| tag | Axis tag, e.g. BLF_VARIATION_AXIS_WEIGHT. |
| factor | -1 to 1 with 0 meaning "default" |
Definition at line 998 of file blf_glyph.cc.
References blf_factor_to_coordinate(), blf_var_axis_by_tag(), BLF_VARIATIONS_MAX, and FontBLF::variations.
|
static |
Set the BLF_VARIATION_AXIS_OPTSIZE (Optical Size) axis to a specific size value.
| coords | Array of design coordinates, per axis. |
| points | Non-zero size in typographic points. |
Definition at line 1120 of file blf_glyph.cc.
References blf_glyph_set_variation_float(), and BLF_VARIATION_AXIS_OPTSIZE.
Referenced by blf_glyph_render().
|
static |
Set the BLF_VARIATION_AXIS_SLANT (Slant) axis to a specific slant value.
| coords | Array of design coordinates, per axis. |
| degrees | Slant in clockwise (opposite to spec) degrees. |
Definition at line 1063 of file blf_glyph.cc.
References blf_glyph_set_variation_float(), and BLF_VARIATION_AXIS_SLANT.
Referenced by blf_glyph_render().
|
static |
Set the proposed BLF_VARIATION_AXIS_SPACING (Spacing) axis to a specific value.
| coords | Array of design coordinates, per axis. |
| spacing | Glyph spacing value. 0.0 is normal, as per spec. |
Definition at line 1101 of file blf_glyph.cc.
References blf_glyph_set_variation_float(), and BLF_VARIATION_AXIS_SPACING.
Referenced by blf_glyph_render().
|
static |
Set the BLF_VARIATION_AXIS_WEIGHT (Weight) axis to a specific weight value.
| coords | Array of design coordinates, per axis. |
| weight | Weight class value (1-1000 allowed, 100-900 typical). |
Definition at line 1044 of file blf_glyph.cc.
References blf_glyph_set_variation_float(), and BLF_VARIATION_AXIS_WEIGHT.
Referenced by blf_glyph_render().
|
static |
Set the BLF_VARIATION_AXIS_WIDTH (Width) axis to a specific width value.
| coords | Array of design coordinates, per axis. |
| width | Glyph width value. 1.0 is normal, as per spec (which uses percent). |
Definition at line 1082 of file blf_glyph.cc.
References blf_glyph_set_variation_float(), and BLF_VARIATION_AXIS_WIDTH.
Referenced by blf_glyph_render().
|
static |
from: http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html#section-1
Vectorial representation of Freetype glyphs
The source format of outlines is a collection of closed paths called "contours". Each contour is made of a series of line segments and bezier arcs. Depending on the file format, these can be second-order or third-order polynomials. The former are also called quadratic or conic arcs, and they come from the TrueType format. The latter are called cubic arcs and mostly come from the Type1 format.
Each arc is described through a series of start, end and control points. Each point of the outline has a specific tag which indicates whether it is used to describe a line segment or an arc. The following rules are applied to decompose the contour's points into segments and arcs :
the "off" point being the control point, and the "on" ones the start and end points.
There must be exactly two cubic control points and two on points for each cubic arc (using a single cubic "off" point between two "on" points is forbidden, for example).
(during the scan-line conversion process exclusively) a virtual "on" point midst them, at their exact middle. This greatly facilitates the definition of successive conic bezier arcs. Moreover, it's the way outlines are described in the TrueType specification.
Note that it is possible to mix conic and cubic arcs in a single contour, even though no current font driver produces such outlines.
* # on
* off
__---__
#-__ _-- -_
--__ _- -
--__ # \
--__ #
-#
Two "on" points
Two "on" points and one "conic" point
between them
*
# __ Two "on" points with two "conic"
\ - - points between them. The point
\ / \ marked '0' is the middle of the
- 0 \ "off" points, and is a 'virtual'
-_ _- # "on" point where the curve passes.
-- It does not appear in the point
list.
*
* # on
* * off
__---__
_-- -_
_- -
# \
#
Two "on" points
and two "cubic" point
between them
Each glyphs original outline points are located on a grid of indivisible units. The points are stored in the font file as 16-bit integer grid coordinates, with the grid origin's being at (0, 0); they thus range from -16384 to 16383.
Convert conic to bezier arcs: Conic P0 P1 P2 Bezier B0 B1 B2 B3 B0=P0 B1=(P0+2*P1)/3 B2=(P2+2*P1)/3 B3=P2
Definition at line 1667 of file blf_glyph.cc.
References Nurb::bezt, BLI_addtail(), CU_BEZIER, CU_NURB_CYCLIC, dist_squared_to_line_v2(), eps, Nurb::flagu, float, BezTriple::h1, BezTriple::h2, HD_ALIGN, HD_FREE, HD_VECT, l, len_squared_v2v2(), max_ff(), MEM_calloc_arrayN(), MEM_callocN(), MEM_freeN(), Nurb::pntsu, BezTriple::radius, Nurb::resolu, Nurb::type, and BezTriple::vec.
Referenced by blf_character_to_curves().
|
static |
Transform glyph to fit nicely within a fixed column width. This conversion of a proportional font glyph into a monospaced glyph only occurs when a mono font does not contain a needed character and must get one from the fallback stack.
Definition at line 1224 of file blf_glyph.cc.
References float, and to_16dot16().
Referenced by blf_glyph_render().
|
static |
Adjust the glyph's slant by a number of degrees. Used for fonts without BLF_VARIATION_AXIS_SLANT variable axis.
| degrees | amount of tilt to add in clockwise degrees. |
Definition at line 1167 of file blf_glyph.cc.
References degrees(), FontBLF::face, FontBLF::ft_size, to_16dot16(), and transform().
Referenced by blf_glyph_render().
|
static |
Adjust the glyph spacing by factor. Used for fonts without BLF_VARIATION_AXIS_SPACING variable axis.
| factor | -1 (make tighter) <= 0 (normal) => 1 (add space). |
Definition at line 1208 of file blf_glyph.cc.
References FontBLF::face, FontBLF::ft_size, and size().
Referenced by blf_glyph_render().
|
static |
Adjust the glyph's weight by a factor. Used for fonts without BLF_VARIATION_AXIS_WEIGHT variable axis.
| width | -500 (make thinner) <= 0 (normal) => 500 (add boldness). |
Definition at line 1140 of file blf_glyph.cc.
References FontBLF::face, and FontBLF::ft_size.
Referenced by blf_glyph_render().
|
static |
Adjust the glyph width by factor. Used for fonts without BLF_VARIATION_AXIS_WIDTH variable axis.
| factor | -1 (subtract width) <= 0 (normal) => 1 (add width). |
Definition at line 1190 of file blf_glyph.cc.
References to_16dot16().
Referenced by blf_glyph_render().
|
static |
Definition at line 1846 of file blf_glyph.cc.
References blf_ensure_face(), blf_get_char_index(), blf_glyph_index_from_charcode(), blf_glyph_render(), ELEM, FontBLF::face, float, to_16dot16(), and transform().
Referenced by blf_character_to_curves().
|
static |
Definition at line 1467 of file blf_glyph.cc.
References ARRAY_SIZE, blf_batch_draw(), BLF_BATCH_DRAW_LEN_MAX, BLI_assert, GlyphBLF::dims, GlyphQuad::flags, g_batch, GlyphQuad::glyph_color, GlyphQuad::glyph_size, GlyphBLF::num_channels, GlyphBLF::offset, GlyphQuad::offset, GlyphQuad::position, and UNPACK4.
Referenced by blf_glyph_draw().
|
static |
Return a design axis that matches an identifying tag.
| variations | Variation descriptors from FT_Get_MM_Var. |
| tag | Axis tag, e.g. BLF_VARIATION_AXIS_WEIGHT. |
| r_axis_index | returns index of axis in variations array. |
Definition at line 946 of file blf_glyph.cc.
References i.
Referenced by blf_glyph_set_variation_float(), and blf_glyph_set_variation_normalized().
|
static |
Convert a floating point value to a FreeType 16.16 fixed point value.
Definition at line 75 of file blf_glyph.cc.
References float.
Referenced by blf_glyph_set_variation_float().
|
static |
Convert a floating point value to a FreeType 16.16 fixed point value.
Definition at line 67 of file blf_glyph.cc.
Referenced by blf_glyph_set_variation_float(), blf_glyph_transform_monospace(), blf_glyph_transform_slant(), blf_glyph_transform_width(), and blf_glyphslot_ensure_outline().
|
static |
Definition at line 463 of file blf_glyph.cc.
Referenced by blf_charcode_to_unicode_block().