diff --git a/src/TextRenderer.cpp b/src/TextRenderer.cpp index 6e97453..f9927b4 100644 --- a/src/TextRenderer.cpp +++ b/src/TextRenderer.cpp @@ -130,7 +130,8 @@ auto TextRenderer::generate_glyph(FontRuntime &rt, FontData &fd, msdfgen::FONT_SCALING_EM_NORMALIZED, &advance_em)) return std::nullopt; shape.normalize(); - msdfgen::edgeColoringInkTrap(shape, 3.0); + // FIXME: Figure out shader + // msdfgen::edgeColoringInkTrap(shape, 3.0); auto bounds = shape.getBounds(); float const width_em = static_cast(bounds.r - bounds.l); float const height_em = static_cast(bounds.t - bounds.b); @@ -173,10 +174,13 @@ auto TextRenderer::generate_glyph(FontRuntime &rt, FontData &fd, for (int x = 0; x < bmp_w; ++x) { float const *px = msdf_bitmap(x, y); auto const r = msdfgen::pixelFloatToByte(px[0]); - auto const g = msdfgen::pixelFloatToByte(px[1]); - auto const b = msdfgen::pixelFloatToByte(px[2]); + // FIXME: Figure out shader + // auto const g = msdfgen::pixelFloatToByte(px[1]); + // auto const b = msdfgen::pixelFloatToByte(px[2]); + // buffer[static_cast(dst_y) * bmp_w + x] + // = Color { r, g, b, 255 }; buffer[static_cast(dst_y) * bmp_w + x] - = Color { r, g, b, 255 }; + = Color { 255, 255, 255, r }; } } @@ -348,12 +352,13 @@ auto TextRenderer::draw_text(FontHandle const font, std::string_view const text, float pen_y_em = 0.0f; rt.frame_stamp++; - BeginShaderMode(m_msdf_shader); - if (m_px_range_uniform >= 0) { - float shader_px_range = rt.px_range; - SetShaderValue(m_msdf_shader, m_px_range_uniform, &shader_px_range, - SHADER_UNIFORM_FLOAT); - } + // FIXME: Figure out shader + // BeginShaderMode(m_msdf_shader); + // if (m_px_range_uniform >= 0) { + // float shader_px_range = rt.px_range; + // SetShaderValue(m_msdf_shader, m_px_range_uniform, &shader_px_range, + // SHADER_UNIFORM_FLOAT); + // } for (unsigned i = 0; i < length; ++i) { u32 glyph_index = infos[i].codepoint; @@ -395,7 +400,7 @@ auto TextRenderer::draw_text(FontHandle const font, std::string_view const text, pen_y_em += hb_to_em(positions[i].y_advance, rt.units_per_em); } - EndShaderMode(); + // EndShaderMode(); hb_buffer_destroy(buffer); auto const draw_end = std::chrono::steady_clock::now(); diff --git a/src/Tick.cpp b/src/Tick.cpp index 7994941..bb531f9 100644 --- a/src/Tick.cpp +++ b/src/Tick.cpp @@ -36,8 +36,8 @@ auto App::tick() -> void if (m_tr) { Color const fg = theme().foreground; Vector2 const pos { 40.0f, 60.0f }; - auto text = std::string_view("Hello from Waylight"); - auto size = 48; + auto text = std::string_view("Hello from Waylight! 日本人ですか?"); + auto size = sin(GetTime()) * 12 + 32; m_tr->draw_text(m_font, text, pos, size, fg); }