Blender V5.3
vfont_curve.cc File Reference
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cwctype>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.hh"
#include "BLI_math_base_safe.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_rect.hh"
#include "BLI_string_utf8.hh"
#include "BLI_threads.hh"
#include "BLI_utildefines.hh"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_vfont_types.h"
#include "BKE_anim_path.h"
#include "BKE_curve.hh"
#include "BKE_object_types.hh"
#include "BKE_vfont.hh"
#include "BKE_vfontdata.hh"

Go to the source code of this file.

Classes

struct  blender::VCharPlaceHolder
struct  blender::VFontToCurveIter
struct  blender::VFontCursor_Params
struct  blender::VFontInfoContext
struct  blender::TextBoxBounds_ForCursor
struct  blender::TempLineInfo

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define MARGIN_X_MIN   (cu_offset_scale.x + tb_scale.x)
#define MARGIN_Y_MIN   (cu_offset_scale.y + tb_scale.y)
#define XTRAX_WITH_CHAR_WIDTH(twidth)

Functions

Private Utilities
static void blender::mid_v2v2 (float a[2], float b[2])
static float blender::vfont_metrics_ascent (const VFontData_Metrics *metrics)
static float blender::vfont_metrics_descent (const VFontData_Metrics *metrics)
static VFont * blender::vfont_from_charinfo (const Curve &cu, const CharInfo *info)
static VFontData * blender::vfont_data_ensure (VFont *vfont)
static bool blender::vfont_char_find_no_lock (const VFontData *vfd, char32_t charcode, VChar **r_che)
static bool blender::vfont_char_find (const VFontData *vfd, char32_t charcode, VChar **r_che)
static VChar * blender::vfont_char_ensure (VFont *vfont, char32_t charcode)
VFont to Curve: Character Placeholder

Simple utility to create a dummy VChar on demand which can be used when the character's glyph isn't available.

static VChar * blender::vfont_placeholder_ensure (VCharPlaceHolder &che_placeholder, char32_t charcode)
static VChar * blender::vfont_char_find_or_placeholder (const VFontData *vfd, char32_t charcode, VCharPlaceHolder &che_placeholder)
VFont Build Character
static Nurb * blender::build_underline (const Curve &cu, ListBaseT< Nurb > *nubase, const rctf *rect, const float yofs, const float rotate, const int charidx, const short mat_nr, const float font_size, Nurb *ul_prev_nu)
static void blender::vfont_char_build_impl (const Curve &cu, ListBaseT< Nurb > *nubase, const VChar *che, const CharInfo *info, const bool is_smallcaps, const float2 &offset, const float rotate, const int charidx, const float fsize)
static float blender::vfont_char_width (const Curve &cu, VChar *che, const bool is_smallcaps)
static bool blender::vfont_char_is_combining (const char32_t charcode, const float char_width)
static char32_t blender::vfont_char_apply_smallcaps (char32_t charcode, const bool is_smallcaps)
static void blender::textbox_scale (TextBox *tb_dst, const TextBox *tb_src, float scale)
VFont Curve & Text Layout API

See vfont_curve.c.

void blender::BKE_vfont_char_build (const Curve &cu, ListBaseT< Nurb > *nubase, unsigned int charcode, const CharInfo *info, bool is_smallcaps, const float2 &offset, float rotate, int charidx, float fsize)
bool blender::BKE_vfont_to_curve_ex (Object *ob, const Curve &cu, eEditFontMode mode, ListBaseT< Nurb > *r_nubase, const char32_t **r_text, int *r_text_len, bool *r_text_free, CharTrans **r_chartransdata, float *r_font_size_eval)
int blender::BKE_vfont_cursor_to_text_index (Object *ob, const float2 &cursor_location)
bool blender::BKE_vfont_to_curve_nubase (Object *ob, eEditFontMode mode, ListBaseT< Nurb > *r_nubase)
bool blender::BKE_vfont_to_curve (Object *ob, eEditFontMode mode)
VFont to Curve: Info Context
static void blender::vfont_info_context_init (VFontInfoContext *vfinfo_ctx, const Curve &cu)
static void blender::vfont_info_context_update (VFontInfoContext *vfinfo_ctx, const Curve &cu, const CharInfo *info)
VFont to Curve: 3D Text Layout Implementation
static bool blender::vfont_to_curve (Object *ob, const Curve &cu, const eEditFontMode mode, VFontToCurveIter &iter_data, VFontCursor_Params *cursor_params, ListBaseT< Nurb > *r_nubase, const char32_t **r_text, int *r_text_len, bool *r_text_free, CharTrans **r_chartransdata, float *r_font_size_eval)

Variables

static ThreadRWMutex blender::vfont_rwlock = BLI_RWLOCK_INITIALIZER

VFont to Curve: Mouse Cursor to Text Offset

This is an optional argument to vfont_to_curve for getting the text offset into the string at a mouse cursor location. Used for getting text cursor (caret) position or selection range.

#define FONT_TO_CURVE_SCALE_ITERATIONS   20
#define FONT_TO_CURVE_SCALE_THRESHOLD   0.0001f
enum  { blender::VFONT_TO_CURVE_INIT = 0 , blender::VFONT_TO_CURVE_BISECT , blender::VFONT_TO_CURVE_SCALE_ONCE , blender::VFONT_TO_CURVE_DONE }

Detailed Description

Utilities relating to converting VFont's to curves as well as 3D text object layout.

Definition in file vfont_curve.cc.

Macro Definition Documentation

◆ FONT_TO_CURVE_SCALE_ITERATIONS

#define FONT_TO_CURVE_SCALE_ITERATIONS   20

◆ FONT_TO_CURVE_SCALE_THRESHOLD

#define FONT_TO_CURVE_SCALE_THRESHOLD   0.0001f

Definition at line 632 of file vfont_curve.cc.

Referenced by blender::vfont_to_curve().

◆ MARGIN_X_MIN

#define MARGIN_X_MIN   (cu_offset_scale.x + tb_scale.x)

Referenced by blender::vfont_to_curve().

◆ MARGIN_Y_MIN

#define MARGIN_Y_MIN   (cu_offset_scale.y + tb_scale.y)

Referenced by blender::vfont_to_curve().

◆ XTRAX_WITH_CHAR_WIDTH

#define XTRAX_WITH_CHAR_WIDTH ( twidth)
Value:
(xtrax_contract ? (xtrax * (twidth)) : xtrax)

Referenced by blender::vfont_to_curve().