1 module formoshlep.fonts; 2 3 import dlangui.graphics.fonts; 4 5 package: 6 7 class FormoshlepFontManager : FontManager 8 { 9 private static FontRef font; 10 11 static this() 12 { 13 font = new FormoshlepFont; 14 } 15 16 override: 17 18 ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face) 19 { 20 return font; 21 } 22 23 void checkpoint() 24 { 25 assert(false, "Isn't implemented"); 26 } 27 28 void cleanup() 29 { 30 assert(false, "Isn't implemented"); 31 } 32 } 33 34 class FormoshlepFont : Font 35 { 36 private Glyph _glyph; 37 38 this() { 39 _spaceWidth = 16; 40 _glyph.blackBoxX = 16; 41 _glyph.blackBoxY = 16; 42 _glyph.widthPixels = 16; 43 _glyph.widthScaled = 16; 44 _glyph.originX = 0; 45 _glyph.originY = 0; 46 _glyph.subpixelMode = SubpixelRenderingMode.None; 47 _glyph.glyph = [0]; 48 } 49 50 private static bool isHotkeySymbol(in dchar c, uint textFlags) 51 { 52 return false; 53 } 54 55 override: 56 57 int size() @property { return 16; } 58 int height() @property { return 16; } 59 int weight() @property { return 400; } 60 int baseline() @property { return 0; } 61 bool italic() @property { return false; } 62 string face() @property { return "console"; } 63 FontFamily family() @property { return FontFamily.MonoSpace; } 64 bool isNull() @property { return false; } 65 void checkpoint() {} /// clear usage flags for all entries 66 void cleanup() {} /// removes entries not used after last call of checkpoint() or cleanup() 67 void clearGlyphCache() {} 68 69 Glyph* getCharGlyph(dchar ch, bool withImage) 70 { 71 return &_glyph; 72 } 73 74 //TODO: use tabSize and tabOffset for printing 75 void drawText(DrawBuf drawBuf, int x, int y, in dchar[] text, uint argb_color, int tabSize, int tabOffset, uint textFlags) 76 { 77 assert(false, __FUNCTION__~" isn't implemented"); 78 } 79 }