[Patch] ResourceManualFont separate glyph size


07-08-2014 14:22:15

This patch separates ResourceManualFont glyphs into coord (texture coordinates) and size (glyph metric).

This is necessary in cases where the font texture is of higher (or lower) resolution than would be required for the Font's default size (OpenMW bug #1096).

By default, Size is initialized to (coord.width, coord.height) so that backward compatibility with old fonts is kept.

Index: MyGUIEngine/src/MyGUI_ResourceManualFont.cpp
--- MyGUIEngine/src/MyGUI_ResourceManualFont.cpp (revision 5294)
+++ MyGUIEngine/src/MyGUI_ResourceManualFont.cpp (working copy)
@@ -98,15 +98,23 @@

float advance(utility::parseValue<float>(element->findAttribute("advance")));
FloatPoint bearing(utility::parseValue<FloatPoint>(element->findAttribute("bearing")));
+ // texture coordinates
FloatCoord coord(utility::parseValue<FloatCoord>(element->findAttribute("coord")));
+ // glyph size, default to texture coordinate size
+ std::string sizeString;
+ IntSize size (coord.width, coord.height);
+ if (element->findAttribute("size", sizeString))
+ size = utility::parseValue<IntSize>(sizeString);

if (advance == 0.0f)
- advance = coord.width;
+ advance = size.width;

GlyphInfo& glyphInfo = mCharMap.insert(CharMap::value_type(id, GlyphInfo(
- coord.width,
- coord.height,
+ size.width,
+ size.height,


07-08-2014 20:16:38

Why you used IntSize instead of FloatSize? All other sizes and positions are floats.

Edit: I replaced size with FloatSize.


07-08-2014 21:37:54

My bad. I have all my fonts sizes in pixels, so I used IntSize by accident.