### Godot version

v4.0.beta10.official [d0398f62f]

### System information

Windows 10, Vulkan

### Issue description

When I was testing my `debug_draw_3d` extension, I noticed that the graph titles change their size strangely.
For example, here, with a font size of 41 for one of the titles, instead of `fps5` it draws `fps6` with a font size of 14.
But the ascent of the font is taken correctly, which is why the title goes down a lot.
![godot windows editor dev x86_64_u0CvcAfqjh](https://user-images.githubusercontent.com/7782218/209420557-17f32fcc-c64c-44ff-9f08-4a11119d4ac8.gif)

I found that these hashing functions create the same hash for `fps5: 41`, `fps6: 14` and `fps8: 76`.
https://github.com/godotengine/godot/blob/f7cf9fb148140b86ee5795110373a0d55ff32860/scene/resources/font.cpp#L273-L291
https://github.com/godotengine/godot/blob/f7cf9fb148140b86ee5795110373a0d55ff32860/scene/resources/font.cpp#L303-L323
(also both of these parts of the code are repeated 3 times)

Here's what I get in MRP:
![image](https://user-images.githubusercontent.com/7782218/209420974-0cbcbb95-81a9-42e9-a9af-4b71b8715769.png)

Expected something like this:
![image](https://user-images.githubusercontent.com/7782218/209421473-4a019989-f432-40c0-b9af-c40ec969ade8.png)

Affected `Font` methods: `get_string_size`, `get_multiline_string_size`, `draw_string`, `draw_multiline_string`, `draw_string_outline`, `draw_multiline_string_outline`.

### Steps to reproduce

* Open MRP
* Notice the gray rectangles and the text somewhere near them (the text should be on top of the rectangles)
* Move the slider for the `second_font_size` parameter and watch glitches on some values.

Also, if you cache a lot of variants for `second_font_size`, and then change `first_font_size`(or vice versa), then there will be a more glitches:
![Godot_v4 0-beta10_win64_r0jJoStkQd](https://user-images.githubusercontent.com/7782218/209422373-c4ca1238-b351-4cbc-b451-136bbdb4fee0.gif)


### Minimal reproduction project

[Font Bad Hash.zip](https://github.com/godotengine/godot/files/10298021/Font.Bad.Hash.zip)

ClassDB::bind_method(D_METHOD("set_base_font", "font"), &FontVariation::set_base_font);
	ClassDB::bind_method(D_METHOD("get_base_font"), &FontVariation::get_base_font);
	ClassDB::bind_method(D_METHOD("set_variation_opentype", "coords"), &FontVariation::set_variation_opentype);
	ClassDB::bind_method(D_METHOD("get_variation_opentype"), &FontVariation::get_variation_opentype);
	ClassDB::bind_method(D_METHOD("set_variation_embolden", "strength"), &FontVariation::set_variation_embolden);
	ClassDB::bind_method(D_METHOD("get_variation_embolden"), &FontVariation::get_variation_embolden);
	ClassDB::bind_method(D_METHOD("set_variation_face_index", "face_index"), &FontVariation::set_variation_face_index);
	ClassDB::bind_method(D_METHOD("get_variation_face_index"), &FontVariation::get_variation_face_index);
	ClassDB::bind_method(D_METHOD("set_variation_transform", "transform"), &FontVariation::set_variation_transform);
	ClassDB::bind_method(D_METHOD("get_variation_transform"), &FontVariation::get_variation_transform);
	ClassDB::bind_method(D_METHOD("set_opentype_features", "features"), &FontVariation::set_opentype_features);
	ClassDB::bind_method(D_METHOD("set_spacing", "spacing", "value"), &FontVariation::set_spacing);
	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "base_font", PROPERTY_HINT_RESOURCE_TYPE, "Font"), "set_base_font", "get_base_font");
	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")), "set_fallbacks", "get_fallbacks");
	ADD_GROUP("Variation", "variation_");
	ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "variation_opentype"), "set_variation_opentype", "get_variation_opentype");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "variation_face_index"), "set_variation_face_index", "get_variation_face_index");
	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "variation_embolden", PROPERTY_HINT_RANGE, "-2,2,0.01"), "set_variation_embolden", "get_variation_embolden");
	ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "variation_transform", PROPERTY_HINT_NONE, "suffix:px"), "set_variation_transform", "get_variation_transform");
	ADD_GROUP("OpenType Features", "opentype_");
	ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "opentype_features"), "set_opentype_features", "get_opentype_features");
	ADD_GROUP("Extra Spacing", "spacing_");
	ADD_PROPERTYI(PropertyInfo(Variant::INT, "spacing_glyph", PROPERTY_HINT_NONE, "suffix:px"), "set_spacing", "get_spacing", TextServer::SPACING_GLYPH);
	ADD_PROPERTYI(PropertyInfo(Variant::INT, "spacing_space", PROPERTY_HINT_NONE, "suffix:px"), "set_spacing", "get_spacing", TextServer::SPACING_SPACE);
	ADD_PROPERTYI(PropertyInfo(Variant::INT, "spacing_top", PROPERTY_HINT_NONE, "suffix:px"), "set_spacing", "get_spacing", TextServer::SPACING_TOP);
	ADD_PROPERTYI(PropertyInfo(Variant::INT, "spacing_bottom", PROPERTY_HINT_NONE, "suffix:px"), "set_spacing", "get_spacing", TextServer::SPACING_BOTTOM);
}
void FontVariation::_update_rids() const {