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)
entropy_decoder/entropy_decoder_kernel_2.cpp
entropy_encoder/entropy_encoder_kernel_1.cpp
entropy_encoder/entropy_encoder_kernel_2.cpp
gui_widgets/fonts.cpp
md5/md5_kernel_1.cpp
tokenizer/tokenizer_kernel_1.cpp
unicode/unicode.cpp
......@@ -406,7 +407,6 @@ if (NOT TARGET dlib)
if (NOT DLIB_NO_GUI_SUPPORT)
set(source_files ${source_files}
gui_widgets/fonts.cpp
gui_widgets/widgets.cpp
gui_widgets/drawable.cpp
gui_widgets/canvas_drawing.cpp
......
......@@ -657,6 +657,7 @@ namespace dlib
return true;
}
#ifndef DLIB_NO_GUI_SUPPORT
// ----------------------------------------------------------------------------------------
const std::shared_ptr<font> get_native_font (
......@@ -666,6 +667,7 @@ namespace dlib
}
// ----------------------------------------------------------------------------------------
#endif
}
......
......@@ -8,7 +8,6 @@
#include <string>
#include "fonts_abstract.h"
#include "../gui_core.h"
#include "../algs.h"
#include "../serialize.h"
#include "../unicode.h"
......@@ -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 (
const canvas& c,
const C& c,
const rectangle& rect,
const std::basic_string<T,traits,alloc>& str,
const pixel_type& color,
......@@ -316,9 +315,9 @@ namespace dlib
pos += l.width();
}
}
template <typename T, typename traits, typename alloc>
template <typename C, typename T, typename traits, typename alloc>
void draw_string (
const canvas& c,
const C& c,
const rectangle& rect,
const std::basic_string<T,traits,alloc>& str
) const
......
......@@ -3,7 +3,6 @@
#undef DLIB_FONTs_ABSTRACT_
#ifdef DLIB_FONTs_ABSTRACT_
#include "../gui_core.h"
#include <string>
#include "../serialize.h"
#include "../unicode.h"
......@@ -275,9 +274,9 @@ namespace dlib
- #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 (
const canvas& c,
const C& c,
const rectangle& rect,
const std::basic_string<T,traits,alloc>& str,
const pixel_type& color = rgb_pixel(0,0,0),
......@@ -287,6 +286,7 @@ namespace dlib
) const;
/*!
requires
- C is a dlib::canvas or an object with a compatible interface.
- if (last != std::basic_string<T,traits,alloc>::npos) then
- first <= last
- last < str.size()
......@@ -480,6 +480,8 @@ namespace dlib
const shared_ptr_thread_safe<font> get_native_font(
);
/*!
requires
- DLIB_NO_GUI_SUPPORT is not defined
ensures
- returns a font object that uses the local font
!*/
......
......@@ -2,10 +2,12 @@
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_IGG_FONT_RENDERER_H_
#define DLIB_IGG_FONT_RENDERER_H_
#ifndef DLIB_NO_GUI_SUPPORT
#include "../platform.h"
#include "../gui_widgets.h"
#include "../gui_widgets/fonts.h"
#include "../unicode.h"
#include "../uintn.h"
......@@ -608,5 +610,6 @@ namespace nativefont
}
#endif // DLIB_NO_GUI_SUPPORT
#endif // DLIB_IGG_FONT_RENDERER_H_
......@@ -7,7 +7,7 @@
#include "../algs.h"
#include "../pixel.h"
#include "../matrix.h"
#include "../gui_widgets.h"
#include "../gui_widgets/fonts.h"
#include <cmath>
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