diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj
index 832c2341..c27ae598 100644
--- a/dlanguilib.visualdproj
+++ b/dlanguilib.visualdproj
@@ -47,7 +47,7 @@
0
0
$(DMDInstallDir)windows\bin\dmd.exe
- 3rdparty 3rdparty/libpng/source ../DerelictGL3/source ../DerelictUtil/source
+ 3rdparty 3rdparty/libpng/source ../DerelictGL3/source ../DerelictUtil/source ../DerelictFT/source
$(ConfigurationName)
$(OutDir)
@@ -215,6 +215,11 @@
+
+
+
+
+
@@ -294,6 +299,7 @@
+
diff --git a/src/dlangui/graphics/fonts.d b/src/dlangui/graphics/fonts.d
index 6d1df8b9..dda94a6d 100644
--- a/src/dlangui/graphics/fonts.d
+++ b/src/dlangui/graphics/fonts.d
@@ -4,6 +4,7 @@ public import dlangui.core.types;
public import dlangui.core.logger;
import std.algorithm;
+/// font family
enum FontFamily : ubyte {
Unspecified,
SansSerif,
@@ -13,6 +14,7 @@ enum FontFamily : ubyte {
MonoSpace
}
+/// useful font weight constants
enum FontWeight : int {
Normal = 400,
Bold = 800
@@ -192,21 +194,26 @@ struct FontList {
}
}
+
+/// Access points to fonts.
class FontManager {
static __gshared FontManager _instance;
+ /// sets new font manager singleton instance
static @property void instance(FontManager manager) {
_instance = manager;
}
+ /// returns font manager singleton instance
static @property FontManager instance() {
return _instance;
}
+ /// get font instance best matched specified parameters
abstract ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face);
- // clear usage flags for all entries
+ /// clear usage flags for all entries -- for cleanup of unused fonts
abstract void checkpoint();
- // removes entries not used after last call of checkpoint() or cleanup()
+ /// removes entries not used after last call of checkpoint() or cleanup()
abstract void cleanup();
~this() {}
diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d
new file mode 100644
index 00000000..36ea5d1e
--- /dev/null
+++ b/src/dlangui/graphics/ftfonts.d
@@ -0,0 +1,34 @@
+/// freetype fonts support
+module dlangui.graphics.ftfonts;
+
+import dlangui.graphics.fonts;
+
+import derelict.freetype.ft;
+
+/// FreeType based font manager.
+class FreeTypeFontManager : FontManager {
+
+ private FontList _activeFonts;
+
+ private FontRef _nullFontRef;
+
+ this() {
+ // load dynaic library
+ DerelictFT.load();
+ }
+
+ /// get font instance with specified parameters
+ override ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face) {
+ return _nullFontRef;
+ }
+
+ /// clear usage flags for all entries
+ override void checkpoint() {
+ }
+
+ /// removes entries not used after last call of checkpoint() or cleanup()
+ override void cleanup() {
+ }
+
+ ~this() {}
+}
diff --git a/src/dlangui/platforms/windows/win32fonts.d b/src/dlangui/platforms/windows/win32fonts.d
index d229f45b..6366595f 100644
--- a/src/dlangui/platforms/windows/win32fonts.d
+++ b/src/dlangui/platforms/windows/win32fonts.d
@@ -293,9 +293,9 @@ class Win32Font : Font {
* Font manager implementation based on Win32 API system fonts.
*/
class Win32FontManager : FontManager {
- FontList _activeFonts;
- FontDef[] _fontFaces;
- FontDef*[string] _faceByName;
+ private FontList _activeFonts;
+ private FontDef[] _fontFaces;
+ private FontDef*[string] _faceByName;
/// initialize in constructor
this() {
diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d
index 74c9eaec..95c1acd9 100644
--- a/src/dlangui/platforms/windows/winapp.d
+++ b/src/dlangui/platforms/windows/winapp.d
@@ -16,13 +16,17 @@ import dlangui.widgets.styles;
import dlangui.graphics.drawbuf;
import dlangui.graphics.images;
import dlangui.graphics.fonts;
-import dlangui.graphics.glsupport;
import dlangui.core.logger;
+version (USE_OPENGL) {
+ import dlangui.graphics.glsupport;
+}
+
pragma(lib, "gdi32.lib");
pragma(lib, "user32.lib");
pragma(lib, "libpng15.lib");
+/// this function should be defined in user application!
extern (C) int UIAppMain(string[] args);
immutable WIN_CLASS_NAME = "DLANGUI_APP";