Cleanup: move BLI_vfontdata.h to BKE_vfontdata.h
This didn't belong on blenlib since it uses DNA data types and included a bad-level call to BKE_curve.h. It also meant linking in blenlib would depend on the freetype library, noticeable for thumbnail extraction (see D6408).
This commit is contained in:
parent
26dac33ce1
commit
fd592538d9
|
@ -20,7 +20,7 @@
|
|||
#pragma once
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \ingroup bke
|
||||
* \brief A structure to represent vector fonts,
|
||||
* and to load them from PostScript fonts.
|
||||
*/
|
||||
|
@ -49,11 +49,11 @@ typedef struct VChar {
|
|||
float width;
|
||||
} VChar;
|
||||
|
||||
VFontData *BLI_vfontdata_from_freetypefont(struct PackedFile *pf);
|
||||
VFontData *BLI_vfontdata_copy(const VFontData *vfont_src, const int flag);
|
||||
VFontData *BKE_vfontdata_from_freetypefont(struct PackedFile *pf);
|
||||
VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int flag);
|
||||
|
||||
VChar *BLI_vfontchar_from_freetypefont(struct VFont *vfont, unsigned long character);
|
||||
VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int flag);
|
||||
VChar *BKE_vfontdata_char_from_freetypefont(struct VFont *vfont, unsigned long character);
|
||||
VChar *BKE_vfontdata_char_copy(const VChar *vchar_src, const int flag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
|
@ -60,6 +60,9 @@ set(INC
|
|||
|
||||
set(INC_SYS
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
|
||||
# For `vfontdata_freetype.c`.
|
||||
${FREETYPE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(SRC
|
||||
|
@ -286,6 +289,7 @@ set(SRC
|
|||
intern/tracking_util.c
|
||||
intern/undo_system.c
|
||||
intern/unit.c
|
||||
intern/vfontdata_freetype.c
|
||||
intern/volume.cc
|
||||
intern/volume_render.cc
|
||||
intern/volume_to_mesh.cc
|
||||
|
@ -453,6 +457,7 @@ set(SRC
|
|||
BKE_tracking.h
|
||||
BKE_undo_system.h
|
||||
BKE_unit.h
|
||||
BKE_vfontdata.h
|
||||
BKE_volume.h
|
||||
BKE_volume_render.h
|
||||
BKE_volume_to_mesh.hh
|
||||
|
@ -502,6 +507,9 @@ set(LIB
|
|||
bf_rna
|
||||
bf_shader_fx
|
||||
bf_simulation
|
||||
|
||||
# For `vfontdata_freetype.c`.
|
||||
${FREETYPE_LIBRARY}
|
||||
)
|
||||
|
||||
if(WITH_BINRELOC)
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "BLI_string_utf8.h"
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_vfontdata.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
|
@ -57,6 +56,7 @@
|
|||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_vfontdata.h"
|
||||
|
||||
#include "BLO_read_write.h"
|
||||
|
||||
|
@ -77,7 +77,7 @@ static void vfont_init_data(ID *id)
|
|||
if (pf) {
|
||||
VFontData *vfd;
|
||||
|
||||
vfd = BLI_vfontdata_from_freetypefont(pf);
|
||||
vfd = BKE_vfontdata_from_freetypefont(pf);
|
||||
if (vfd) {
|
||||
vfont->data = vfd;
|
||||
|
||||
|
@ -107,7 +107,7 @@ static void vfont_copy_data(Main *UNUSED(bmain),
|
|||
}
|
||||
|
||||
if (vfont_dst->data) {
|
||||
vfont_dst->data = BLI_vfontdata_copy(vfont_dst->data, flag_subdata);
|
||||
vfont_dst->data = BKE_vfontdata_copy(vfont_dst->data, flag_subdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ static VFontData *vfont_get_data(VFont *vfont)
|
|||
}
|
||||
|
||||
if (pf) {
|
||||
vfont->data = BLI_vfontdata_from_freetypefont(pf);
|
||||
vfont->data = BKE_vfontdata_from_freetypefont(pf);
|
||||
if (pf != vfont->packedfile) {
|
||||
BKE_packedfile_free(pf);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
|
|||
if (pf) {
|
||||
VFontData *vfd;
|
||||
|
||||
vfd = BLI_vfontdata_from_freetypefont(pf);
|
||||
vfd = BKE_vfontdata_from_freetypefont(pf);
|
||||
if (vfd) {
|
||||
/* If there's a font name, use it for the ID name. */
|
||||
vfont = BKE_libblock_alloc(bmain, ID_VF, vfd->name[0] ? vfd->name : filename, 0);
|
||||
|
@ -954,7 +954,7 @@ static bool vfont_to_curve(Object *ob,
|
|||
* happen often once all the chars are load.
|
||||
*/
|
||||
if ((che = find_vfont_char(vfd, ascii)) == NULL) {
|
||||
che = BLI_vfontchar_from_freetypefont(vfont, ascii);
|
||||
che = BKE_vfontdata_char_from_freetypefont(vfont, ascii);
|
||||
}
|
||||
BLI_rw_mutex_unlock(&vfont_rwlock);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,9 @@
|
|||
#include "BLI_string.h"
|
||||
#include "BLI_string_utf8.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_vfontdata.h"
|
||||
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_vfontdata.h"
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_packedFile_types.h"
|
||||
|
@ -402,7 +404,7 @@ static bool check_freetypefont(PackedFile *pf)
|
|||
* \retval A new VFontData structure, or NULL
|
||||
* if unable to load.
|
||||
*/
|
||||
VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
|
||||
VFontData *BKE_vfontdata_from_freetypefont(PackedFile *pf)
|
||||
{
|
||||
VFontData *vfd = NULL;
|
||||
|
||||
|
@ -425,10 +427,10 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
|
|||
|
||||
static void *vfontdata_copy_characters_value_cb(const void *src)
|
||||
{
|
||||
return BLI_vfontchar_copy(src, 0);
|
||||
return BKE_vfontdata_char_copy(src, 0);
|
||||
}
|
||||
|
||||
VFontData *BLI_vfontdata_copy(const VFontData *vfont_src, const int UNUSED(flag))
|
||||
VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int UNUSED(flag))
|
||||
{
|
||||
VFontData *vfont_dst = MEM_dupallocN(vfont_src);
|
||||
|
||||
|
@ -440,7 +442,7 @@ VFontData *BLI_vfontdata_copy(const VFontData *vfont_src, const int UNUSED(flag)
|
|||
return vfont_dst;
|
||||
}
|
||||
|
||||
VChar *BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
|
||||
VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, unsigned long character)
|
||||
{
|
||||
VChar *che = NULL;
|
||||
|
||||
|
@ -464,12 +466,7 @@ VChar *BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
|
|||
return che;
|
||||
}
|
||||
|
||||
/* Yeah, this is very bad... But why is this in BLI in the first place, since it uses Nurb data?
|
||||
* Anyway, do not feel like duplicating whole Nurb copy code here,
|
||||
* so unless someone has a better idea... */
|
||||
#include "../../blenkernel/BKE_curve.h"
|
||||
|
||||
VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
|
||||
VChar *BKE_vfontdata_char_copy(const VChar *vchar_src, const int UNUSED(flag))
|
||||
{
|
||||
VChar *vchar_dst = MEM_dupallocN(vchar_src);
|
||||
|
|
@ -32,7 +32,6 @@ set(INC
|
|||
set(INC_SYS
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${ZSTD_INCLUDE_DIRS}
|
||||
${FREETYPE_INCLUDE_DIRS}
|
||||
${GMP_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
@ -81,7 +80,6 @@ set(SRC
|
|||
intern/filereader_memory.c
|
||||
intern/filereader_zstd.c
|
||||
intern/fnmatch.c
|
||||
intern/freetypefont.c
|
||||
intern/gsqueue.c
|
||||
intern/hash_md5.c
|
||||
intern/hash_mm2a.c
|
||||
|
@ -318,7 +316,6 @@ set(SRC
|
|||
BLI_vector_adaptor.hh
|
||||
BLI_vector_set.hh
|
||||
BLI_vector_set_slots.hh
|
||||
BLI_vfontdata.h
|
||||
BLI_virtual_array.hh
|
||||
BLI_virtual_vector_array.hh
|
||||
BLI_voronoi_2d.h
|
||||
|
@ -334,7 +331,6 @@ set(LIB
|
|||
bf_intern_numaapi
|
||||
extern_wcwidth
|
||||
|
||||
${FREETYPE_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${ZSTD_LIBRARIES}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue