diff --git a/source/blender/blenkernel/BKE_vfont.h b/source/blender/blenkernel/BKE_vfont.h index d738a50c036..3e691cce14f 100644 --- a/source/blender/blenkernel/BKE_vfont.h +++ b/source/blender/blenkernel/BKE_vfont.h @@ -68,6 +68,20 @@ typedef struct EditFont { } EditFont; +typedef enum eEditFontMode { + FO_EDIT = 0, + FO_CURS = 1, + FO_CURSUP = 2, + FO_CURSDOWN = 3, + FO_DUPLI = 4, + FO_PAGEUP = 8, + FO_PAGEDOWN = 9, + FO_SELCHANGE = 10, +} eEditFontMode; + +/* BKE_vfont_to_curve will move the cursor in these cases */ +#define FO_CURS_IS_MOTION(mode) (ELEM(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN)) + bool BKE_vfont_is_builtin(const struct VFont *vfont); void BKE_vfont_builtin_register(const void *mem, int size); @@ -83,20 +97,20 @@ struct VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath); bool BKE_vfont_to_curve_ex(struct Object *ob, struct Curve *cu, - int mode, + eEditFontMode mode, struct ListBase *r_nubase, const char32_t **r_text, int *r_text_len, bool *r_text_free, struct CharTrans **r_chartransdata); -bool BKE_vfont_to_curve_nubase(struct Object *ob, int mode, struct ListBase *r_nubase); +bool BKE_vfont_to_curve_nubase(struct Object *ob, eEditFontMode mode, struct ListBase *r_nubase); int BKE_vfont_cursor_to_text_index(struct Object *ob, float cursor_location[2]); /** * \warning Expects to have access to evaluated data (i.e. passed object should be evaluated one). */ -bool BKE_vfont_to_curve(struct Object *ob, int mode); +bool BKE_vfont_to_curve(struct Object *ob, eEditFontMode mode); void BKE_vfont_build_char(struct Curve *cu, struct ListBase *nubase, unsigned int character, diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c index c95adaf6bca..05e20d5245c 100644 --- a/source/blender/blenkernel/intern/vfont.c +++ b/source/blender/blenkernel/intern/vfont.c @@ -792,7 +792,7 @@ static float vfont_descent(const VFontData *vfd) static bool vfont_to_curve(Object *ob, Curve *cu, - int mode, + const eEditFontMode mode, VFontToCurveIter *iter_data, VFontCursor_Params *cursor_params, ListBase *r_nubase, @@ -1501,6 +1501,12 @@ static bool vfont_to_curve(Object *ob, case FO_PAGEDOWN: lnr = ct->linenr + 10; break; + /* Ignored. */ + case FO_EDIT: + case FO_CURS: + case FO_DUPLI: + case FO_SELCHANGE: + break; } cnr = ct->charnr; /* Seek for char with `lnr` & `cnr`. */ @@ -1826,7 +1832,7 @@ finally: bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, - int mode, + const eEditFontMode mode, ListBase *r_nubase, const char32_t **r_text, int *r_text_len, @@ -1880,14 +1886,14 @@ int BKE_vfont_cursor_to_text_index(Object *ob, float cursor_location[2]) #undef FONT_TO_CURVE_SCALE_ITERATIONS #undef FONT_TO_CURVE_SCALE_THRESHOLD -bool BKE_vfont_to_curve_nubase(Object *ob, int mode, ListBase *r_nubase) +bool BKE_vfont_to_curve_nubase(Object *ob, const eEditFontMode mode, ListBase *r_nubase) { BLI_assert(ob->type == OB_FONT); return BKE_vfont_to_curve_ex(ob, ob->data, mode, r_nubase, NULL, NULL, NULL, NULL); } -bool BKE_vfont_to_curve(Object *ob, int mode) +bool BKE_vfont_to_curve(Object *ob, const eEditFontMode mode) { Curve *cu = ob->data; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index d634aca1831..ea8e92be506 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -394,7 +394,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c) return 0; } -static void text_update_edited(bContext *C, Object *obedit, int mode) +static void text_update_edited(bContext *C, Object *obedit, const eEditFontMode mode) { Curve *cu = obedit->data; EditFont *ef = cu->editfont; diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 3cb8fcef100..a071e38f013 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -34,19 +34,6 @@ typedef struct VFont { struct PackedFile *temp_pf; } VFont; -/* *************** FONT ****************** */ -#define FO_EDIT 0 -#define FO_CURS 1 -#define FO_CURSUP 2 -#define FO_CURSDOWN 3 -#define FO_DUPLI 4 -#define FO_PAGEUP 8 -#define FO_PAGEDOWN 9 -#define FO_SELCHANGE 10 - -/* BKE_vfont_to_curve will move the cursor in these cases */ -#define FO_CURS_IS_MOTION(mode) (ELEM(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN)) - #define FO_BUILTIN_NAME "" #ifdef __cplusplus