diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 2a257482..5967bf4a 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -985,7 +985,7 @@ void LottieBuilder::updateImage(LottieGroup* layer) void LottieBuilder::updateText(LottieLayer* layer, float frameNo) { auto text = static_cast(layer->children.first()); - auto textGrouping = text->alignmentOption.grouping; + auto textGrouping = text->alignOption.grouping; auto& doc = text->doc(frameNo); auto p = doc.text; @@ -1127,7 +1127,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo) identity(&textGroupMatrix); translate(&textGroupMatrix, cursor.x, cursor.y); - auto alignment = text->alignmentOption.anchor(frameNo); + auto alignment = text->alignOption.anchor(frameNo); // center pivoting textGroupMatrix.e13 += alignment.x; diff --git a/src/loaders/lottie/tvgLottieModel.h b/src/loaders/lottie/tvgLottieModel.h index a314567b..fa3ca866 100644 --- a/src/loaders/lottie/tvgLottieModel.h +++ b/src/loaders/lottie/tvgLottieModel.h @@ -179,29 +179,26 @@ struct LottieGlyph }; -struct LottieTextStyle -{ - LottieColor fillColor = RGB24{255, 255, 255}; - LottieColor strokeColor = RGB24{255, 255, 255}; - LottiePosition position = Point{0, 0}; - LottiePoint scale = Point{100, 100}; - LottieFloat letterSpacing = 0.0f; - LottieFloat lineSpacing = 0.0f; - LottieFloat strokeWidth = 0.0f; - LottieFloat rotation = 0.0f; - LottieOpacity fillOpacity = 255; - LottieOpacity strokeOpacity = 255; - LottieOpacity opacity = 255; -}; - - struct LottieTextRange { enum Based : uint8_t { Chars = 1, CharsExcludingSpaces, Words, Lines }; enum Shape : uint8_t { Square = 1, RampUp, RampDown, Triangle, Round, Smooth }; enum Unit : uint8_t { Percent = 1, Index }; - LottieTextStyle style; + struct { + LottieColor fillColor = RGB24{255, 255, 255}; + LottieColor strokeColor = RGB24{255, 255, 255}; + LottiePosition position = Point{0, 0}; + LottiePoint scale = Point{100, 100}; + LottieFloat letterSpacing = 0.0f; + LottieFloat lineSpacing = 0.0f; + LottieFloat strokeWidth = 0.0f; + LottieFloat rotation = 0.0f; + LottieOpacity fillOpacity = 255; + LottieOpacity strokeOpacity = 255; + LottieOpacity opacity = 255; + } style; + LottieFloat offset = 0.0f; LottieFloat maxEase = 0.0f; LottieFloat minEase = 0.0f; @@ -257,8 +254,8 @@ struct LottieText : LottieObject, LottieRenderPooler { enum Group : uint8_t { Chars = 1, Word = 2, Line = 3, All = 4 }; Group grouping = Chars; - LottiePoint anchor = Point{0.0f, 0.0f}; - }; + LottiePoint anchor{}; + } alignOption; void prepare() { @@ -280,7 +277,6 @@ struct LottieText : LottieObject, LottieRenderPooler LottieTextDoc doc; LottieFont* font; Array ranges; - AlignOption alignmentOption; ~LottieText() { diff --git a/src/loaders/lottie/tvgLottieParser.cpp b/src/loaders/lottie/tvgLottieParser.cpp index 27d9003f..2f8f353b 100644 --- a/src/loaders/lottie/tvgLottieParser.cpp +++ b/src/loaders/lottie/tvgLottieParser.cpp @@ -1133,8 +1133,8 @@ void LottieParser::parseTextAlignmentOption(LottieText* text) { enterObject(); while (auto key = nextObjectKey()) { - if (KEY_AS("g")) text->alignmentOption.grouping = (LottieText::AlignOption::Group) getInt(); - else if (KEY_AS("a")) parseProperty(text->alignmentOption.anchor); + if (KEY_AS("g")) text->alignOption.grouping = (LottieText::AlignOption::Group) getInt(); + else if (KEY_AS("a")) parseProperty(text->alignOption.anchor); else skip(key); } }