summaryrefslogtreecommitdiff
path: root/scene/resources/font.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/font.h')
-rw-r--r--scene/resources/font.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 61f0352992..03b1ec5191 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -36,21 +36,21 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
class Font : public Resource {
-
+
OBJ_TYPE( Font, Resource );
RES_BASE_EXTENSION("fnt");
-
+
Vector< Ref<Texture> > textures;
public:
struct Character {
-
+
int texture_idx;
Rect2 rect;
float v_align;
float h_align;
float advance;
-
+
Character() { texture_idx=0; v_align=0; }
};
@@ -69,10 +69,10 @@ public:
private:
-
+
HashMap< CharType, Character > char_map;
Map<KerningPairKey,int> kerning_map;
-
+
float height;
float ascent;
bool distance_field_hint;
@@ -86,20 +86,20 @@ private:
Ref<Font> fallback;
protected:
-
+
static void _bind_methods();
public:
Error create_from_fnt(const String& p_file);
-
+
void set_height(float p_height);
float get_height() const;
-
+
void set_ascent(float p_ascent);
- float get_ascent() const;
+ float get_ascent() const;
float get_descent() const;
-
+
void add_texture(const Ref<Texture>& p_texture);
void add_char(CharType p_char, int p_texture_idx, const Rect2& p_rect, const Size2& p_align, float p_advance=-1);
@@ -116,7 +116,7 @@ public:
inline Size2 get_char_size(CharType p_char,CharType p_next=0) const;
Size2 get_string_size(const String& p_string) const;
-
+
void set_fallback(const Ref<Font> &p_fallback);
Ref<Font> get_fallback() const;
@@ -125,11 +125,11 @@ public:
void set_distance_field_hint(bool p_distance_field);
bool is_distance_field_hint() const;
-
+
void draw(RID p_canvas_item, const Point2& p_pos, const String& p_text,const Color& p_modulate=Color(1,1,1),int p_clip_w=-1) const;
void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const;
float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const;
-
+
Font();
~Font();
};