@@ -257,7 +257,7 @@ namespace Babylon::Polyfills::Internal
257
257
void Context::Rotate (const Napi::CallbackInfo& info)
258
258
{
259
259
const auto angle = info[0 ].As <Napi::Number>().FloatValue ();
260
- nvgRotate (m_nvg, nvgDegToRad ( angle) );
260
+ nvgRotate (m_nvg, angle);
261
261
SetDirty ();
262
262
}
263
263
@@ -594,10 +594,10 @@ namespace Babylon::Polyfills::Internal
594
594
// Default font id, and font size values.
595
595
// TODO: Determine better way of signaling to user that font specified is invalid.
596
596
m_currentFontId = -1 ;
597
- int fontSize = 16 ;
597
+ float fontSize{ 16 . f } ;
598
598
599
599
// Regex to parse font styling information. For now we are only capturing font size (capture group 3) and font family name (capture group 4).
600
- static const std::regex fontStyleRegex (" ([[a-zA-Z]+\\ s+)*((\\ d+)px\\ s+)?(\\ w+)" );
600
+ static const std::regex fontStyleRegex (" ([[a-zA-Z]+\\ s+)*((\\ d+( \\ . \\ d+)? )px\\ s+)?(\\ w+)" );
601
601
std::smatch fontStyleMatch;
602
602
603
603
// Perform the actual regex_match.
@@ -606,7 +606,7 @@ namespace Babylon::Polyfills::Internal
606
606
// Check if font size was specified.
607
607
if (fontStyleMatch[3 ].matched )
608
608
{
609
- fontSize = std::stoi (fontStyleMatch[3 ]);
609
+ fontSize = std::stof (fontStyleMatch[3 ]);
610
610
}
611
611
612
612
// Check if the specified font family name is valid, and if so assign the current font id.
@@ -618,7 +618,7 @@ namespace Babylon::Polyfills::Internal
618
618
}
619
619
620
620
// Set font size on the current context.
621
- nvgFontSize (m_nvg, static_cast < float >( fontSize) );
621
+ nvgFontSize (m_nvg, fontSize);
622
622
}
623
623
624
624
void Context::SetGlobalAlpha (const Napi::CallbackInfo& info, const Napi::Value& value)
0 commit comments