Kaynağa Gözat

obs-text: text transform add locale

Support transform accented characters
Exeldro 6 yıl önce
ebeveyn
işleme
fd879e56f0
1 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. 4 2
      plugins/obs-text/gdiplus/obs-text.cpp

+ 4 - 2
plugins/obs-text/gdiplus/obs-text.cpp

@@ -657,10 +657,12 @@ void TextSource::LoadFileText()
 
 void TextSource::TransformText()
 {
+	const locale loc = locale(obs_get_locale());
+	const ctype<wchar_t> &f = use_facet<ctype<wchar_t>>(loc);
 	if (text_transform == S_TRANSFORM_UPPERCASE)
-		transform(text.begin(), text.end(), text.begin(), towupper);
+		f.toupper(&text[0], &text[0] + text.size());
 	else if (text_transform == S_TRANSFORM_LOWERCASE)
-		transform(text.begin(), text.end(), text.begin(), towlower);
+		f.tolower(&text[0], &text[0] + text.size());
 }
 
 #define obs_data_get_uint32 (uint32_t) obs_data_get_int