MCPcopy Create free account
hub / github.com/Tencent/libpag / CheckTextDirection

Function CheckTextDirection

exporter/src/export/data/TextProperty.cpp:192–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192static void CheckTextDirection(pag::Property<pag::TextDocumentHandle>* textDocument,
193 uint16_t tagLevel) {
194 if (textDocument == nullptr) {
195 return;
196 }
197 bool hasVerticalText = false;
198 if (textDocument->animatable()) {
199 for (const auto& keyFrame :
200 reinterpret_cast<pag::AnimatableProperty<pag::TextDocumentHandle>*>(textDocument)
201 ->keyframes) {
202 if (keyFrame->startValue->direction == pag::TextDirection::Vertical ||
203 keyFrame->endValue->direction == pag::TextDirection::Vertical) {
204 hasVerticalText = true;
205 break;
206 }
207 }
208 if (!hasVerticalText || tagLevel < static_cast<uint16_t>(pag::TagCode::TextSourceV3)) {
209 for (auto& keyframe :
210 reinterpret_cast<pag::AnimatableProperty<pag::TextDocumentHandle>*>(textDocument)
211 ->keyframes) {
212 keyframe->startValue->direction = pag::TextDirection::Default;
213 keyframe->endValue->direction = pag::TextDirection::Default;
214 }
215 }
216 } else {
217 auto document = textDocument->getValueAt(0);
218 if (document->direction == pag::TextDirection::Vertical) {
219 hasVerticalText = true;
220 }
221 if (!hasVerticalText || tagLevel < static_cast<uint16_t>(pag::TagCode::TextSourceV3)) {
222 document->direction = pag::TextDirection::Default;
223 }
224 }
225
226 if (hasVerticalText && tagLevel < static_cast<uint16_t>(pag::TagCode::TextSourceV3)) {
227 PAGExportSessionManager::GetInstance()->recordWarning(AlertInfoType::TagLevelVerticalText);
228 }
229}
230
231static std::vector<pag::TextSelector*> GetTextSelectors(const AEGP_StreamRefH& streamHandle) {
232 const auto& Suites = GetSuites();

Callers 1

GetTextPropertiesFunction · 0.85

Calls 3

recordWarningMethod · 0.80
animatableMethod · 0.45
getValueAtMethod · 0.45

Tested by

no test coverage detected