1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 #pragma once 20 21 /** \file 22 * \ingroup bke 23 */ 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 struct CharInfo; 30 struct Curve; 31 struct Main; 32 struct Object; 33 struct VFont; 34 35 struct CharTrans { 36 float xof, yof; 37 float rot; 38 short linenr, charnr; 39 char dobreak; 40 }; 41 42 typedef struct EditFontSelBox { 43 float x, y, w, h; 44 float rot; 45 } EditFontSelBox; 46 47 typedef struct EditFont { 48 char32_t *textbuf; 49 struct CharInfo *textbufinfo; 50 51 /* array of rectangles & rotation */ 52 float textcurs[4][2]; 53 EditFontSelBox *selboxes; 54 int selboxes_len; 55 56 /* positional vars relative to the textbuf, textbufinfo (not utf8 bytes) 57 * a copy of these is kept in Curve, but use these in editmode */ 58 int len, pos; 59 int selstart, selend; 60 61 /** 62 * ID data is older than edit-mode data. 63 * Set #Main.is_memfile_undo_flush_needed when enabling. 64 */ 65 char needs_flush_to_id; 66 67 } EditFont; 68 69 bool BKE_vfont_is_builtin(struct VFont *vfont); 70 void BKE_vfont_builtin_register(void *mem, int size); 71 72 void BKE_vfont_free_data(struct VFont *vfont); 73 struct VFont *BKE_vfont_builtin_get(void); 74 struct VFont *BKE_vfont_load(struct Main *bmain, const char *filepath); 75 struct VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists); 76 struct VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath); 77 78 bool BKE_vfont_to_curve_ex(struct Object *ob, 79 struct Curve *cu, 80 int mode, 81 struct ListBase *r_nubase, 82 const char32_t **r_text, 83 int *r_text_len, 84 bool *r_text_free, 85 struct CharTrans **r_chartransdata); 86 bool BKE_vfont_to_curve_nubase(struct Object *ob, int mode, struct ListBase *r_nubase); 87 bool BKE_vfont_to_curve(struct Object *ob, int mode); 88 89 int BKE_vfont_select_get(struct Object *ob, int *r_start, int *r_end); 90 void BKE_vfont_select_clamp(struct Object *ob); 91 92 void BKE_vfont_clipboard_free(void); 93 void BKE_vfont_clipboard_set(const char32_t *text_buf, 94 const struct CharInfo *info_buf, 95 const size_t len); 96 void BKE_vfont_clipboard_get(char32_t **r_text_buf, 97 struct CharInfo **r_info_buf, 98 size_t *r_len_utf8, 99 size_t *r_len_utf32); 100 101 #ifdef __cplusplus 102 } 103 #endif 104