diff --git a/3rdparty/win32/shlobj.d b/3rdparty/win32/shlobj.d
index 9fa51168..36ba5759 100644
--- a/3rdparty/win32/shlobj.d
+++ b/3rdparty/win32/shlobj.d
@@ -1226,7 +1226,9 @@ static if (_WIN32_IE >= 0x400) {
}
/* SHGetFolderPath in shfolder.dll on W9x, NT4, also in shell32.dll on W2K */
+extern (Windows)
HRESULT SHGetFolderPathA(HWND, int, HANDLE, DWORD, LPSTR);
+extern (Windows)
HRESULT SHGetFolderPathW(HWND, int, HANDLE, DWORD, LPWSTR);
static if (_WIN32_WINNT >= 0x500) {
diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj
index c27ae598..e9b082c9 100644
--- a/dlanguilib.visualdproj
+++ b/dlanguilib.visualdproj
@@ -268,6 +268,7 @@
+
diff --git a/examples/example1/example1.visualdproj b/examples/example1/example1.visualdproj
index 1550e39d..d4011694 100644
--- a/examples/example1/example1.visualdproj
+++ b/examples/example1/example1.visualdproj
@@ -83,7 +83,7 @@
- libpng15.lib dlangui.lib phobos.lib ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib dlangui.lib
+ libpng15.lib dlangui.lib phobos.lib ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib dlangui.lib
../../Debug ../../3rdparty/libpng/lib 3rdparty/libpng/lib ../../../DerelictOpenGL3/source
diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d
index 8f0ee271..d776952b 100644
--- a/src/dlangui/graphics/ftfonts.d
+++ b/src/dlangui/graphics/ftfonts.d
@@ -4,6 +4,24 @@ module dlangui.graphics.ftfonts;
import dlangui.graphics.fonts;
import derelict.freetype.ft;
+private import dlangui.core.logger;
+
+private struct FontDef {
+ immutable FontFamily _family;
+ immutable string _face;
+ immutable bool _italic;
+ immutable int _weight;
+ @property FontFamily family() { return _family; }
+ @property string face() { return _face; }
+ @property bool italic() { return _italic; }
+ @property int weight() { return _weight; }
+ this(FontFamily family, string face, bool italic, int weight) {
+ _family = family;
+ _face = face;
+ _italic = italic;
+ _weight = weight;
+ }
+}
/// FreeType based font manager.
class FreeTypeFontManager : FontManager {
@@ -32,6 +50,7 @@ class FreeTypeFontManager : FontManager {
/// register freetype font by filename - optinally font properties can be passed if known (e.g. from libfontconfig).
bool registerFont(string filename, FontFamily family = FontFamily.SansSerif, string face = null, bool italic = false, int weight = 0) {
+ Log.d("FreeTypeFontManager.registerFont ", filename, " ", family, " ", face, " italic=", italic, " weight=", weight);
return false;
}
diff --git a/src/dlangui/platforms/windows/win32fonts.d b/src/dlangui/platforms/windows/win32fonts.d
index 6366595f..4d2ee996 100644
--- a/src/dlangui/platforms/windows/win32fonts.d
+++ b/src/dlangui/platforms/windows/win32fonts.d
@@ -13,7 +13,7 @@ import std.utf;
//return toUTFz!(const(wchar)*)(s);
//}
-struct FontDef {
+private struct FontDef {
immutable FontFamily _family;
immutable string _face;
immutable ubyte _pitchAndFamily;
diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d
index 795dda23..49fe5d00 100644
--- a/src/dlangui/platforms/windows/winapp.d
+++ b/src/dlangui/platforms/windows/winapp.d
@@ -417,9 +417,38 @@ int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
Win32FontManager fontMan = new Win32FontManager();
FontManager.instance = fontMan;
- /// testing freetype font manager
- import dlangui.graphics.ftfonts;
- FreeTypeFontManager ftfontMan = new FreeTypeFontManager();
+ {
+ /// testing freetype font manager
+ import dlangui.graphics.ftfonts;
+ import win32.shlobj;
+ FreeTypeFontManager ftfontMan = new FreeTypeFontManager();
+ string fontsPath = "c:\\Windows\\Fonts\\";
+ static if (false) { // SHGetFolderPathW not found in shell32.lib
+ WCHAR szPath[MAX_PATH];
+ const CSIDL_FLAG_NO_ALIAS = 0x1000;
+ const CSIDL_FLAG_DONT_UNEXPAND = 0x2000;
+ if(SUCCEEDED(SHGetFolderPathW(NULL,
+ CSIDL_FONTS|CSIDL_FLAG_NO_ALIAS|CSIDL_FLAG_DONT_UNEXPAND,
+ NULL,
+ 0,
+ szPath.ptr)))
+ {
+ fontsPath = toUTF8(fromWStringz(szPath));
+ }
+ }
+ ftfontMan.registerFont(fontsPath ~ "arial.ttf", FontFamily.SansSerif, "Arial", false, FontWeight.Normal);
+ ftfontMan.registerFont(fontsPath ~ "arialbd.ttf", FontFamily.SansSerif, "Arial", false, FontWeight.Bold);
+ ftfontMan.registerFont(fontsPath ~ "arialbi.ttf", FontFamily.SansSerif, "Arial", true, FontWeight.Bold);
+ ftfontMan.registerFont(fontsPath ~ "ariali.ttf", FontFamily.SansSerif, "Arial", true, FontWeight.Normal);
+ ftfontMan.registerFont(fontsPath ~ "cour.ttf", FontFamily.MonoSpace, "Courier New", false, FontWeight.Normal);
+ ftfontMan.registerFont(fontsPath ~ "courbd.ttf", FontFamily.MonoSpace, "Courier New", false, FontWeight.Bold);
+ ftfontMan.registerFont(fontsPath ~ "courbi.ttf", FontFamily.MonoSpace, "Courier New", true, FontWeight.Bold);
+ ftfontMan.registerFont(fontsPath ~ "couri.ttf", FontFamily.MonoSpace, "Courier New", true, FontWeight.Normal);
+ ftfontMan.registerFont(fontsPath ~ "times.ttf", FontFamily.Serif, "Times New Roman", false, FontWeight.Normal);
+ ftfontMan.registerFont(fontsPath ~ "timesbd.ttf", FontFamily.Serif, "Times New Roman", false, FontWeight.Bold);
+ ftfontMan.registerFont(fontsPath ~ "timesbi.ttf", FontFamily.Serif, "Times New Roman", true, FontWeight.Bold);
+ ftfontMan.registerFont(fontsPath ~ "timesi.ttf", FontFamily.Serif, "Times New Roman", true, FontWeight.Normal);
+ }
version (USE_OPENGL) {
import derelict.opengl3.gl3;