33 #include "scene/resources/texture.h" 41 RES_BASE_EXTENSION(
"fnt");
67 _FORCE_INLINE_
bool operator<(
const KerningPairKey& p_r)
const {
return pair<p_r.pair; }
78 bool distance_field_hint;
90 static void _bind_methods();
94 Error create_from_fnt(
const String& p_file);
96 void set_height(
float p_height);
97 float get_height()
const;
99 void set_ascent(
float p_ascent);
100 float get_ascent()
const;
101 float get_descent()
const;
104 void add_char(CharType p_char,
int p_texture_idx,
const Rect2& p_rect,
const Size2& p_align,
float p_advance=-1);
106 int get_character_count()
const;
108 Character get_character(CharType p_char)
const;
110 int get_texture_count()
const;
113 void add_kerning_pair(CharType p_A,CharType p_B,
int p_kerning);
114 int get_kerning_pair(CharType p_A,CharType p_B)
const;
117 inline Size2 get_char_size(CharType p_char,CharType p_next=0)
const;
118 Size2 get_string_size(
const String& p_string)
const;
121 void set_fallback(
const Ref<Font> &p_fallback);
126 void set_distance_field_hint(
bool p_distance_field);
127 bool is_distance_field_hint()
const;
129 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;
130 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;
131 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;
138 Size2 Font::get_char_size(CharType p_char,CharType p_next)
const {
140 const Character * c = char_map.getptr(p_char);
143 if (fallback.is_valid())
144 return fallback->get_char_size(p_char,p_next);
148 Size2 ret(c->advance,c->rect.size.y);
Definition: math_2d.h:204
Definition: hash_map.h:84
Definition: resource.h:89