Set the default font for text objects correctly.

The default font is BitstreamVeraSans-Roman-builtin.ttf since 94b26ddfac,
but on Win32 it needs to be `res://fonts/...` URI to work.

Fixes: https://github.com/solvespace/solvespace/issues/821
pull/824/head
ruevs 2020-11-23 13:52:17 +02:00
parent a2b5d0d45c
commit 9390ab02d5
2 changed files with 7 additions and 1 deletions

View File

@ -1117,7 +1117,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my, bool shiftDown, bool ct
AddToPending(hr); AddToPending(hr);
Request *r = SK.GetRequest(hr); Request *r = SK.GetRequest(hr);
r->str = "Abc"; r->str = "Abc";
r->font = "BitstreamVeraSans-Roman-builtin.ttf"; r->font = Platform::embeddedFont;
for(int i = 1; i <= 4; i++) { for(int i = 1; i <= 4; i++) {
SK.GetEntity(hr.entity(i))->PointForceTo(v); SK.GetEntity(hr.entity(i))->PointForceTo(v);

View File

@ -17,6 +17,12 @@ std::string Narrow(const std::wstring &s);
std::wstring Widen(const std::string &s); std::wstring Widen(const std::string &s);
#endif #endif
#if defined(_WIN32)
const std::string embeddedFont = "res://fonts/BitstreamVeraSans-Roman-builtin.ttf";
#else // Linux and macOS
const std::string embeddedFont = "BitstreamVeraSans-Roman-builtin.ttf";
#endif
// A filesystem path, respecting the conventions of the current platform. // A filesystem path, respecting the conventions of the current platform.
// Transformation functions return an empty path on error. // Transformation functions return an empty path on error.
class Path { class Path {