"tests/python/vscode:/vscode.git/clone" did not exist on "dc8a027903ef9d37ff1b05ecde049465f3214ed5"
Unverified Commit 71dd9a6c authored by Adrià Arrufat's avatar Adrià Arrufat Committed by GitHub
Browse files

Remove GUI dependency from fonts (#2273)



* Remove GUI dependency from fonts

* use #ifndef

* Updated docs more
Co-authored-by: default avatarDavis King <davis@dlib.net>
parent 187b73f7
...@@ -269,6 +269,7 @@ if (NOT TARGET dlib) ...@@ -269,6 +269,7 @@ if (NOT TARGET dlib)
entropy_decoder/entropy_decoder_kernel_2.cpp entropy_decoder/entropy_decoder_kernel_2.cpp
entropy_encoder/entropy_encoder_kernel_1.cpp entropy_encoder/entropy_encoder_kernel_1.cpp
entropy_encoder/entropy_encoder_kernel_2.cpp entropy_encoder/entropy_encoder_kernel_2.cpp
gui_widgets/fonts.cpp
md5/md5_kernel_1.cpp md5/md5_kernel_1.cpp
tokenizer/tokenizer_kernel_1.cpp tokenizer/tokenizer_kernel_1.cpp
unicode/unicode.cpp unicode/unicode.cpp
...@@ -406,7 +407,6 @@ if (NOT TARGET dlib) ...@@ -406,7 +407,6 @@ if (NOT TARGET dlib)
if (NOT DLIB_NO_GUI_SUPPORT) if (NOT DLIB_NO_GUI_SUPPORT)
set(source_files ${source_files} set(source_files ${source_files}
gui_widgets/fonts.cpp
gui_widgets/widgets.cpp gui_widgets/widgets.cpp
gui_widgets/drawable.cpp gui_widgets/drawable.cpp
gui_widgets/canvas_drawing.cpp gui_widgets/canvas_drawing.cpp
......
...@@ -657,6 +657,7 @@ namespace dlib ...@@ -657,6 +657,7 @@ namespace dlib
return true; return true;
} }
#ifndef DLIB_NO_GUI_SUPPORT
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
const std::shared_ptr<font> get_native_font ( const std::shared_ptr<font> get_native_font (
...@@ -666,6 +667,7 @@ namespace dlib ...@@ -666,6 +667,7 @@ namespace dlib
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
#endif
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <string> #include <string>
#include "fonts_abstract.h" #include "fonts_abstract.h"
#include "../gui_core.h"
#include "../algs.h" #include "../algs.h"
#include "../serialize.h" #include "../serialize.h"
#include "../unicode.h" #include "../unicode.h"
...@@ -224,9 +223,9 @@ namespace dlib ...@@ -224,9 +223,9 @@ namespace dlib
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
template <typename T, typename traits, typename alloc, typename pixel_type> template <typename C, typename T, typename traits, typename alloc, typename pixel_type>
void draw_string ( void draw_string (
const canvas& c, const C& c,
const rectangle& rect, const rectangle& rect,
const std::basic_string<T,traits,alloc>& str, const std::basic_string<T,traits,alloc>& str,
const pixel_type& color, const pixel_type& color,
...@@ -316,9 +315,9 @@ namespace dlib ...@@ -316,9 +315,9 @@ namespace dlib
pos += l.width(); pos += l.width();
} }
} }
template <typename T, typename traits, typename alloc> template <typename C, typename T, typename traits, typename alloc>
void draw_string ( void draw_string (
const canvas& c, const C& c,
const rectangle& rect, const rectangle& rect,
const std::basic_string<T,traits,alloc>& str const std::basic_string<T,traits,alloc>& str
) const ) const
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#undef DLIB_FONTs_ABSTRACT_ #undef DLIB_FONTs_ABSTRACT_
#ifdef DLIB_FONTs_ABSTRACT_ #ifdef DLIB_FONTs_ABSTRACT_
#include "../gui_core.h"
#include <string> #include <string>
#include "../serialize.h" #include "../serialize.h"
#include "../unicode.h" #include "../unicode.h"
...@@ -275,9 +274,9 @@ namespace dlib ...@@ -275,9 +274,9 @@ namespace dlib
- #height == (count(str.begin(),str.end(),'\n')+1)*height() - #height == (count(str.begin(),str.end(),'\n')+1)*height()
!*/ !*/
template <typename T, typename traits, typename alloc, typename pixel_type> template <typename C, typename T, typename traits, typename alloc, typename pixel_type>
void draw_string ( void draw_string (
const canvas& c, const C& c,
const rectangle& rect, const rectangle& rect,
const std::basic_string<T,traits,alloc>& str, const std::basic_string<T,traits,alloc>& str,
const pixel_type& color = rgb_pixel(0,0,0), const pixel_type& color = rgb_pixel(0,0,0),
...@@ -287,6 +286,7 @@ namespace dlib ...@@ -287,6 +286,7 @@ namespace dlib
) const; ) const;
/*! /*!
requires requires
- C is a dlib::canvas or an object with a compatible interface.
- if (last != std::basic_string<T,traits,alloc>::npos) then - if (last != std::basic_string<T,traits,alloc>::npos) then
- first <= last - first <= last
- last < str.size() - last < str.size()
...@@ -480,6 +480,8 @@ namespace dlib ...@@ -480,6 +480,8 @@ namespace dlib
const shared_ptr_thread_safe<font> get_native_font( const shared_ptr_thread_safe<font> get_native_font(
); );
/*! /*!
requires
- DLIB_NO_GUI_SUPPORT is not defined
ensures ensures
- returns a font object that uses the local font - returns a font object that uses the local font
!*/ !*/
......
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
// License: Boost Software License See LICENSE.txt for the full license. // License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_IGG_FONT_RENDERER_H_ #ifndef DLIB_IGG_FONT_RENDERER_H_
#define DLIB_IGG_FONT_RENDERER_H_ #define DLIB_IGG_FONT_RENDERER_H_
#ifndef DLIB_NO_GUI_SUPPORT
#include "../platform.h" #include "../platform.h"
#include "../gui_widgets.h" #include "../gui_widgets/fonts.h"
#include "../unicode.h" #include "../unicode.h"
#include "../uintn.h" #include "../uintn.h"
...@@ -608,5 +610,6 @@ namespace nativefont ...@@ -608,5 +610,6 @@ namespace nativefont
} }
#endif // DLIB_NO_GUI_SUPPORT
#endif // DLIB_IGG_FONT_RENDERER_H_ #endif // DLIB_IGG_FONT_RENDERER_H_
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "../algs.h" #include "../algs.h"
#include "../pixel.h" #include "../pixel.h"
#include "../matrix.h" #include "../matrix.h"
#include "../gui_widgets.h" #include "../gui_widgets/fonts.h"
#include <cmath> #include <cmath>
namespace dlib namespace dlib
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment