1 /** 2 Used with $(D DynamicFont) to describe the location of a font file. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.dynamicfontdata; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.resource; 24 import godot.reference; 25 /** 26 Used with $(D DynamicFont) to describe the location of a font file. 27 28 Used with $(D DynamicFont) to describe the location of a vector font file for dynamic rendering at runtime. 29 */ 30 @GodotBaseClass struct DynamicFontData 31 { 32 enum string _GODOT_internal_name = "DynamicFontData"; 33 public: 34 @nogc nothrow: 35 union { godot_object _godot_object; Resource _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct _classBinding 40 { 41 __gshared: 42 @GodotName("set_font_path") GodotMethod!(void, String) setFontPath; 43 @GodotName("get_font_path") GodotMethod!(String) getFontPath; 44 @GodotName("set_hinting") GodotMethod!(void, long) setHinting; 45 @GodotName("get_hinting") GodotMethod!(DynamicFontData.Hinting) getHinting; 46 } 47 bool opEquals(in DynamicFontData other) const { return _godot_object.ptr is other._godot_object.ptr; } 48 DynamicFontData opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 49 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 50 mixin baseCasts; 51 static DynamicFontData _new() 52 { 53 static godot_class_constructor constructor; 54 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("DynamicFontData"); 55 if(constructor is null) return typeof(this).init; 56 return cast(DynamicFontData)(constructor()); 57 } 58 @disable new(size_t s); 59 /// 60 enum Hinting : int 61 { 62 /** 63 Disable font hinting (smoother but less crisp). 64 */ 65 hintingNone = 0, 66 /** 67 Use the light font hinting mode. 68 */ 69 hintingLight = 1, 70 /** 71 Use the default font hinting mode (crisper but less smooth). 72 */ 73 hintingNormal = 2, 74 } 75 /// 76 enum Constants : int 77 { 78 hintingNone = 0, 79 hintingLight = 1, 80 hintingNormal = 2, 81 } 82 /** 83 84 */ 85 void setFontPath(StringArg0)(in StringArg0 path) 86 { 87 checkClassBinding!(typeof(this))(); 88 ptrcall!(void)(_classBinding.setFontPath, _godot_object, path); 89 } 90 /** 91 92 */ 93 String getFontPath() const 94 { 95 checkClassBinding!(typeof(this))(); 96 return ptrcall!(String)(_classBinding.getFontPath, _godot_object); 97 } 98 /** 99 100 */ 101 void setHinting(in long mode) 102 { 103 checkClassBinding!(typeof(this))(); 104 ptrcall!(void)(_classBinding.setHinting, _godot_object, mode); 105 } 106 /** 107 108 */ 109 DynamicFontData.Hinting getHinting() const 110 { 111 checkClassBinding!(typeof(this))(); 112 return ptrcall!(DynamicFontData.Hinting)(_classBinding.getHinting, _godot_object); 113 } 114 /** 115 The font hinting mode used by FreeType. 116 */ 117 @property DynamicFontData.Hinting hinting() 118 { 119 return getHinting(); 120 } 121 /// ditto 122 @property void hinting(long v) 123 { 124 setHinting(v); 125 } 126 /** 127 The path to the vector font file. 128 */ 129 @property String fontPath() 130 { 131 return getFontPath(); 132 } 133 /// ditto 134 @property void fontPath(String v) 135 { 136 setFontPath(v); 137 } 138 }