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.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.resource; 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 package(godot) 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 GDNativeClassBinding 40 { 41 __gshared: 42 @GodotName("get_font_path") GodotMethod!(String) getFontPath; 43 @GodotName("get_hinting") GodotMethod!(DynamicFontData.Hinting) getHinting; 44 @GodotName("is_antialiased") GodotMethod!(bool) isAntialiased; 45 @GodotName("set_antialiased") GodotMethod!(void, bool) setAntialiased; 46 @GodotName("set_font_path") GodotMethod!(void, String) setFontPath; 47 @GodotName("set_hinting") GodotMethod!(void, long) setHinting; 48 } 49 /// 50 pragma(inline, true) bool opEquals(in DynamicFontData other) const 51 { return _godot_object.ptr is other._godot_object.ptr; } 52 /// 53 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 54 { _godot_object.ptr = n; return null; } 55 /// 56 pragma(inline, true) bool opEquals(typeof(null) n) const 57 { return _godot_object.ptr is n; } 58 /// 59 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 60 mixin baseCasts; 61 /// Construct a new instance of DynamicFontData. 62 /// Note: use `memnew!DynamicFontData` instead. 63 static DynamicFontData _new() 64 { 65 static godot_class_constructor constructor; 66 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("DynamicFontData"); 67 if(constructor is null) return typeof(this).init; 68 return cast(DynamicFontData)(constructor()); 69 } 70 @disable new(size_t s); 71 /// 72 enum Hinting : int 73 { 74 /** 75 Disables font hinting (smoother but less crisp). 76 */ 77 hintingNone = 0, 78 /** 79 Use the light font hinting mode. 80 */ 81 hintingLight = 1, 82 /** 83 Use the default font hinting mode (crisper but less smooth). 84 */ 85 hintingNormal = 2, 86 } 87 /// 88 enum Constants : int 89 { 90 hintingNone = 0, 91 hintingLight = 1, 92 hintingNormal = 2, 93 } 94 /** 95 96 */ 97 String getFontPath() const 98 { 99 checkClassBinding!(typeof(this))(); 100 return ptrcall!(String)(GDNativeClassBinding.getFontPath, _godot_object); 101 } 102 /** 103 104 */ 105 DynamicFontData.Hinting getHinting() const 106 { 107 checkClassBinding!(typeof(this))(); 108 return ptrcall!(DynamicFontData.Hinting)(GDNativeClassBinding.getHinting, _godot_object); 109 } 110 /** 111 112 */ 113 bool isAntialiased() const 114 { 115 checkClassBinding!(typeof(this))(); 116 return ptrcall!(bool)(GDNativeClassBinding.isAntialiased, _godot_object); 117 } 118 /** 119 120 */ 121 void setAntialiased(in bool antialiased) 122 { 123 checkClassBinding!(typeof(this))(); 124 ptrcall!(void)(GDNativeClassBinding.setAntialiased, _godot_object, antialiased); 125 } 126 /** 127 128 */ 129 void setFontPath(in String path) 130 { 131 checkClassBinding!(typeof(this))(); 132 ptrcall!(void)(GDNativeClassBinding.setFontPath, _godot_object, path); 133 } 134 /** 135 136 */ 137 void setHinting(in long mode) 138 { 139 checkClassBinding!(typeof(this))(); 140 ptrcall!(void)(GDNativeClassBinding.setHinting, _godot_object, mode); 141 } 142 /** 143 If `true`, the font is rendered with anti-aliasing. This property applies both to the main font and its outline (if it has one). 144 */ 145 @property bool antialiased() 146 { 147 return isAntialiased(); 148 } 149 /// ditto 150 @property void antialiased(bool v) 151 { 152 setAntialiased(v); 153 } 154 /** 155 The path to the vector font file. 156 */ 157 @property String fontPath() 158 { 159 return getFontPath(); 160 } 161 /// ditto 162 @property void fontPath(String v) 163 { 164 setFontPath(v); 165 } 166 /** 167 The font hinting mode used by FreeType. See $(D hinting) for options. 168 */ 169 @property DynamicFontData.Hinting hinting() 170 { 171 return getHinting(); 172 } 173 /// ditto 174 @property void hinting(long v) 175 { 176 setHinting(v); 177 } 178 }