瀏覽代碼

Ceil dynamic font glyph size

Fixes #15459. When oversampling is enabled, glyphs may have fractional
size, but they are still rendered into integral pixels, which results in
them taking more space than was anticiped by autowrapping algorithm. The
solution here is to return ceiled width, which makes autowrapper
consider characters a bit larger than they are, but it doesn't hurt the
actual rendering and ensures there is enough space for the characters.
Ruslan Mustakov 7 年之前
父節點
當前提交
aa8561ded4
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      scene/resources/dynamic_font.cpp

+ 3 - 0
scene/resources/dynamic_font.cpp

@@ -308,6 +308,9 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const V
 			ret.x += (delta.x >> 6) / oversampling;
 			ret.x += (delta.x >> 6) / oversampling;
 		}
 		}
 	}
 	}
+
+	// ensures oversampled glyphs will have enough space when this value is used by clipping/wrapping algorithms
+	ret.x = Math::ceil(ret.x);
 	return ret;
 	return ret;
 }
 }