소스 검색

Support point size as a user-configurable property (#572)

jjsy212 4 달 전
부모
커밋
ea1b73d895
3개의 변경된 파일과 3개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      src/WallpaperEngine/Data/Model/Object.h
  2. 1 1
      src/WallpaperEngine/Data/Parsers/ObjectParser.cpp
  3. 1 1
      src/WallpaperEngine/Render/Objects/CText.cpp

+ 1 - 1
src/WallpaperEngine/Data/Model/Object.h

@@ -597,7 +597,7 @@ struct TextData {
     /** Font reference from scene (e.g. "fonts/VCR_OSD_MONO.ttf" or "systemfont_arial") */
     std::string font;
     /** Font size in points */
-    float pointsize;
+    UserSettingUniquePtr pointsize;
     /** Bounding box size */
     glm::vec2 size;
     /** Scale (x, y, z) */

+ 1 - 1
src/WallpaperEngine/Data/Parsers/ObjectParser.cpp

@@ -250,7 +250,7 @@ TextUniquePtr ObjectParser::parseText (const JSON& it, const Project& project, O
 	    .script = std::move (script),
 	    .scriptProperties = std::move (scriptProps),
 	    .font = it.optional ("font", std::string ()),
-	    .pointsize = it.optional ("pointsize", 32.0f),
+	    .pointsize = it.user ("pointsize", properties, 32.0f),
 	    .size = it.optional ("size", glm::vec2 (0.0f)),
 	    .scale = it.user ("scale", properties, glm::vec3 (1.0f)),
 	    .color = it.user ("color", properties, glm::vec4 (1.0f)),

+ 1 - 1
src/WallpaperEngine/Render/Objects/CText.cpp

@@ -179,7 +179,7 @@ unsigned int CText::computeEffectivePixelSize () const {
 	? std::min (1.0f / avgScale, 32.0f)
 	: 1.0f;
     return std::max<unsigned int> (
-	1u, static_cast<unsigned int> (static_cast<float> (m_text.pointsize) * compensate));
+	1u, static_cast<unsigned int> (m_text.pointsize->value->getFloat () * compensate));
 }
 
 void CText::initScriptLayer () {