mirror of https://github.com/buggins/dlangui.git
FreeType support stub added
This commit is contained in:
parent
3113577041
commit
2a50741e52
|
@ -47,7 +47,7 @@
|
||||||
<compiler>0</compiler>
|
<compiler>0</compiler>
|
||||||
<otherDMD>0</otherDMD>
|
<otherDMD>0</otherDMD>
|
||||||
<program>$(DMDInstallDir)windows\bin\dmd.exe</program>
|
<program>$(DMDInstallDir)windows\bin\dmd.exe</program>
|
||||||
<imppath>3rdparty 3rdparty/libpng/source ../DerelictGL3/source ../DerelictUtil/source</imppath>
|
<imppath>3rdparty 3rdparty/libpng/source ../DerelictGL3/source ../DerelictUtil/source ../DerelictFT/source</imppath>
|
||||||
<fileImppath />
|
<fileImppath />
|
||||||
<outdir>$(ConfigurationName)</outdir>
|
<outdir>$(ConfigurationName)</outdir>
|
||||||
<objdir>$(OutDir)</objdir>
|
<objdir>$(OutDir)</objdir>
|
||||||
|
@ -215,6 +215,11 @@
|
||||||
<File path="..\DerelictGL3\source\derelict\opengl3\wgl.d" />
|
<File path="..\DerelictGL3\source\derelict\opengl3\wgl.d" />
|
||||||
<File path="..\DerelictGL3\source\derelict\opengl3\wglext.d" />
|
<File path="..\DerelictGL3\source\derelict\opengl3\wglext.d" />
|
||||||
</Folder>
|
</Folder>
|
||||||
|
<Folder name="DerelictFT">
|
||||||
|
<File path="..\DerelictFT\source\derelict\freetype\ft.d" />
|
||||||
|
<File path="..\DerelictFT\source\derelict\freetype\functions.d" />
|
||||||
|
<File path="..\DerelictFT\source\derelict\freetype\types.d" />
|
||||||
|
</Folder>
|
||||||
<Folder name="gl3n">
|
<Folder name="gl3n">
|
||||||
<File path="..\gl3n\gl3n\aabb.d" />
|
<File path="..\gl3n\gl3n\aabb.d" />
|
||||||
<File path="..\gl3n\gl3n\frustum.d" />
|
<File path="..\gl3n\gl3n\frustum.d" />
|
||||||
|
@ -294,6 +299,7 @@
|
||||||
<Folder name="graphics">
|
<Folder name="graphics">
|
||||||
<File path="src\dlangui\graphics\drawbuf.d" />
|
<File path="src\dlangui\graphics\drawbuf.d" />
|
||||||
<File path="src\dlangui\graphics\fonts.d" />
|
<File path="src\dlangui\graphics\fonts.d" />
|
||||||
|
<File path="src\dlangui\graphics\ftfonts.d" />
|
||||||
<File path="src\dlangui\graphics\gldrawbuf.d" />
|
<File path="src\dlangui\graphics\gldrawbuf.d" />
|
||||||
<File path="src\dlangui\graphics\glsupport.d" />
|
<File path="src\dlangui\graphics\glsupport.d" />
|
||||||
<File path="src\dlangui\graphics\images.d" />
|
<File path="src\dlangui\graphics\images.d" />
|
||||||
|
|
|
@ -4,6 +4,7 @@ public import dlangui.core.types;
|
||||||
public import dlangui.core.logger;
|
public import dlangui.core.logger;
|
||||||
import std.algorithm;
|
import std.algorithm;
|
||||||
|
|
||||||
|
/// font family
|
||||||
enum FontFamily : ubyte {
|
enum FontFamily : ubyte {
|
||||||
Unspecified,
|
Unspecified,
|
||||||
SansSerif,
|
SansSerif,
|
||||||
|
@ -13,6 +14,7 @@ enum FontFamily : ubyte {
|
||||||
MonoSpace
|
MonoSpace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// useful font weight constants
|
||||||
enum FontWeight : int {
|
enum FontWeight : int {
|
||||||
Normal = 400,
|
Normal = 400,
|
||||||
Bold = 800
|
Bold = 800
|
||||||
|
@ -192,21 +194,26 @@ struct FontList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Access points to fonts.
|
||||||
class FontManager {
|
class FontManager {
|
||||||
static __gshared FontManager _instance;
|
static __gshared FontManager _instance;
|
||||||
|
/// sets new font manager singleton instance
|
||||||
static @property void instance(FontManager manager) {
|
static @property void instance(FontManager manager) {
|
||||||
_instance = manager;
|
_instance = manager;
|
||||||
}
|
}
|
||||||
|
/// returns font manager singleton instance
|
||||||
static @property FontManager instance() {
|
static @property FontManager instance() {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// get font instance best matched specified parameters
|
||||||
abstract ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face);
|
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();
|
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();
|
abstract void cleanup();
|
||||||
|
|
||||||
~this() {}
|
~this() {}
|
||||||
|
|
|
@ -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() {}
|
||||||
|
}
|
|
@ -293,9 +293,9 @@ class Win32Font : Font {
|
||||||
* Font manager implementation based on Win32 API system fonts.
|
* Font manager implementation based on Win32 API system fonts.
|
||||||
*/
|
*/
|
||||||
class Win32FontManager : FontManager {
|
class Win32FontManager : FontManager {
|
||||||
FontList _activeFonts;
|
private FontList _activeFonts;
|
||||||
FontDef[] _fontFaces;
|
private FontDef[] _fontFaces;
|
||||||
FontDef*[string] _faceByName;
|
private FontDef*[string] _faceByName;
|
||||||
|
|
||||||
/// initialize in constructor
|
/// initialize in constructor
|
||||||
this() {
|
this() {
|
||||||
|
|
|
@ -16,13 +16,17 @@ import dlangui.widgets.styles;
|
||||||
import dlangui.graphics.drawbuf;
|
import dlangui.graphics.drawbuf;
|
||||||
import dlangui.graphics.images;
|
import dlangui.graphics.images;
|
||||||
import dlangui.graphics.fonts;
|
import dlangui.graphics.fonts;
|
||||||
import dlangui.graphics.glsupport;
|
|
||||||
import dlangui.core.logger;
|
import dlangui.core.logger;
|
||||||
|
|
||||||
|
version (USE_OPENGL) {
|
||||||
|
import dlangui.graphics.glsupport;
|
||||||
|
}
|
||||||
|
|
||||||
pragma(lib, "gdi32.lib");
|
pragma(lib, "gdi32.lib");
|
||||||
pragma(lib, "user32.lib");
|
pragma(lib, "user32.lib");
|
||||||
pragma(lib, "libpng15.lib");
|
pragma(lib, "libpng15.lib");
|
||||||
|
|
||||||
|
/// this function should be defined in user application!
|
||||||
extern (C) int UIAppMain(string[] args);
|
extern (C) int UIAppMain(string[] args);
|
||||||
|
|
||||||
immutable WIN_CLASS_NAME = "DLANGUI_APP";
|
immutable WIN_CLASS_NAME = "DLANGUI_APP";
|
||||||
|
|
Loading…
Reference in New Issue