Update msdfgen; Orient contours properly;

This fixes issues where some fonts would have glyphs with weird windings
and they would get rendered inside-out.

Unfortunately updating msdfgen increased its size by a factor of 2-3x.
This commit is contained in:
bjorn 2023-10-03 10:41:24 -07:00
parent 3041a9a484
commit f0686f0115
3 changed files with 8 additions and 3 deletions

View File

@ -144,11 +144,15 @@ endif()
# MSDF
if(LOVR_ENABLE_DATA)
set(BUILD_SHARED_LIBS ON)
set(MSDFGEN_CORE_ONLY ON CACHE BOOL "")
set(MSDFGEN_BUILD_STANDALONE OFF CACHE BOOL "")
set(MSDFGEN_USE_VCPKG OFF CACHE BOOL "")
set(MSDFGEN_USE_CPP11 OFF CACHE BOOL "")
add_subdirectory(deps/msdfgen msdfgen)
include_directories(deps/msdfgen)
set(LOVR_MSDF msdfgen)
set(LOVR_MSDF msdfgen-core)
if(APPLE)
set_target_properties(msdfgen PROPERTIES MACOSX_RPATH ON)
set_target_properties(msdfgen-core PROPERTIES MACOSX_RPATH ON)
endif()
endif()

2
deps/msdfgen vendored

@ -1 +1 @@
Subproject commit 6f7eda06adc23bc14ca2e14190d69ae1d00f1740
Subproject commit aaf33b059c115203667996a052fb75a8e88ac09d

View File

@ -218,6 +218,7 @@ bool lovrRasterizerGetPixels(Rasterizer* rasterizer, uint32_t codepoint, float*
float offsetY = -y0 * scale + padding;
msShapeNormalize(shape);
msShapeOrientContours(shape);
msEdgeColoringSimple(shape, 3., 0);
msGenerateMTSDF(pixels, width, height, shape, spread, 1.f, 1.f, offsetX, offsetY);
msShapeDestroy(shape);