Download

Font Outline Sharp Corners

Hi,

I’ve been trying to get font-outlines to render with sharp corners rather than their default of rounded.

I’ve altered Line 399 of SlateFontRenderer.cpp to the following in the hopes of getting Freetype to render the corners as desired:


FT_Stroker_Set(Stroker, FMath::TruncToInt(FreeTypeUtils::ConvertPixelTo26Dot6<float>(ScaledOutlineSize)), FT_STROKER_LINECAP_BUTT, FT_STROKER_LINEJOIN_MITER_FIXED, FMath::TruncToInt(FreeTypeUtils::ConvertPixelTo16Dot16<float>(ScaledOutlineSize)));

This produces the sharp corners I’m after, but also results in outlines being offset from the base character. This is particularly noticeable on fonts with angled edges:
a88083ca8589747ba9f26aafd04b7da03175baa4.png

I’ve tried various other combinations of **LINECAP **and **LINEJOIN **types, with all but the default _ROUND values producing this effect. I’ve had a look through the surrounding code, but the Freetype libraries are a bit of a mystery to me.

I’m not sure if the extension of the outline area due to the join is causing the dimensions of the outline to be calculated incorretly.

Setting the miter_limit parameter to 0 reduces the offset (though it’s still present), but that then caps the intersections of edges, rather than joining them at points.

Any suggestions as to what I’m missing would be greatly appreciated!