diff --git a/src/Plugins/MagnumFont/Test/font.conf b/src/Plugins/MagnumFont/Test/font.conf index 0a771d745..1b5553a04 100644 --- a/src/Plugins/MagnumFont/Test/font.conf +++ b/src/Plugins/MagnumFont/Test/font.conf @@ -19,11 +19,11 @@ unicode=76 advance=11 0 glyph=0 [glyph] -position=0 0 -rectangle=0 0 0 0 +position=24 24 +rectangle=24 24 -24 -24 [glyph] -position=1 -12 -rectangle=-8 -20 88 56 +position=25 12 +rectangle=16 4 64 32 [glyph] -position=1 10 -rectangle=-24 -16 40 152 +position=25 34 +rectangle=0 8 16 128 diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp index ab2d155ad..2c10c006e 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp +++ b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp @@ -78,12 +78,15 @@ std::vector>> MagnumFont group->setValue("glyph", found == glyphIdMap.end() ? 0 : glyphIdMap.at(glyphId)); } - /* Save glyph properties in order which preserves their IDs */ + /* Save glyph properties in order which preserves their IDs, remove padding + from the values so they aren't added twice when using the font later */ + /** @todo Some better way to handle this padding stuff */ for(UnsignedInt oldGlyphId: inverseGlyphIdMap) { std::pair glyph = (*cache)[oldGlyphId]; Utility::ConfigurationGroup* group = configuration.addGroup("glyph"); - group->setValue("position", glyph.first); - group->setValue("rectangle", glyph.second); + group->setValue("position", glyph.first+cache->padding()); + group->setValue("rectangle", Rectanglei(glyph.second.bottomLeft()+cache->padding(), + glyph.second.topRight()-cache->padding())); } std::ostringstream confOut;