godotengine / godotengine/godot-docs

Font class's get_char_size() method doesn't return the font's height.

Open
#5,884 6 comments 0 reactions 0 assignees View on GitHub
area:class reference bug
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
v3.4.4.stable.official [419e713a2]

**Issue description:**
says
> [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html#class-vector2) get_char_size ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html#class-int) char, [int](https://docs.godotengine.org/en/stable/classes/class_int.html#class-int) next=0 ) const
>
> Returns the size of a character, optionally taking kerning into account if the next character is provided. Note that the height returned is the font height (see [get_height](https://docs.godotengine.org/en/stable/classes/class_font.html?highlight=draw_char#class-font-method-get-height)) and has no relation to the glyph height.
>

but

```
var label = Label.new()
font = label.get_font("")
print(font.get_char_size(ord(".")), "=", font.get_string_size(","))
label.free()

```
prints "(4, 2)=(4, 14)"

14 in the value returned by get_height ( )

**URL to the documentation page:**
https://docs.godotengine.org/en/stable/classes/class_font.html?highlight=draw_char#class-font-method-get-char-size

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.