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

Function GetTextProperties

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

Source from the content-addressed store, hash-verified

601}
602
603void GetTextProperties(std::shared_ptr<PAGExportSession> session, const AEGP_LayerH& layerHandle,
604 pag::TextLayer* layer) {
605 const auto& Suites = GetSuites();
606 const auto& PluginID = GetPluginID();
607
608 AEGP_StreamRefH layerStreamHandle = nullptr;
609 Suites->DynamicStreamSuite4()->AEGP_GetNewStreamRefForLayer(PluginID, layerHandle,
610 &layerStreamHandle);
611 if (layerStreamHandle == nullptr) {
612 return;
613 }
614 AEGP_StreamRefH rootStreamHandle = nullptr;
615 Suites->DynamicStreamSuite4()->AEGP_GetNewStreamRefByMatchname(
616 PluginID, layerStreamHandle, "ADBE Text Properties", &rootStreamHandle);
617 if (rootStreamHandle == nullptr) {
618 Suites->StreamSuite4()->AEGP_DisposeStream(layerStreamHandle);
619 return;
620 }
621 Suites->StreamSuite4()->AEGP_DisposeStream(layerStreamHandle);
622 if (IsStreamHidden(rootStreamHandle) || !IsStreamActive(rootStreamHandle)) {
623 Suites->StreamSuite4()->AEGP_DisposeStream(rootStreamHandle);
624 return;
625 }
626
627 A_long numStreams = 0;
628 Suites->DynamicStreamSuite4()->AEGP_GetNumStreamsInGroup(rootStreamHandle, &numStreams);
629 for (A_long index = 0; index < numStreams; index++) {
630 AEGP_StreamRefH streamHandle = nullptr;
631 Suites->DynamicStreamSuite4()->AEGP_GetNewStreamRefByIndex(PluginID, rootStreamHandle, index,
632 &streamHandle);
633 if (streamHandle == nullptr) {
634 continue;
635 }
636 if (!IsStreamHidden(rootStreamHandle) || IsStreamActive(rootStreamHandle)) {
637 auto type = GetTextPropertyType(streamHandle);
638 switch (type) {
639 case TextPropertyType::Document: {
640 QVariantMap map = {};
641 map["runJavaScript"] = session->enableRunScript;
642 map["compID"] = session->compID;
643 map["layerIndex"] = session->layerIndex;
644 map["keyFrame"] = 0;
645 if (session->configParam.exportFontFile) {
646 map["outPath"] = QString(session->outputPath.data());
647 }
648 layer->sourceText = GetProperty(streamHandle, AEStreamParser::TextDocumentParser, map);
649 CheckTextDirection(layer->sourceText, session->configParam.exportTagLevel);
650 break;
651 }
652 case TextPropertyType::PathOptions: {
653 layer->pathOption = GetTextPathOptions(streamHandle);
654 break;
655 }
656 case TextPropertyType::Animators: {
657 auto animators = GetTextAnimators(streamHandle);
658 layer->animators.insert(layer->animators.end(), animators.begin(), animators.end());
659 break;
660 }

Callers 1

CreateTextLayerFunction · 0.85

Calls 12

GetSuitesFunction · 0.85
GetPluginIDFunction · 0.85
IsStreamHiddenFunction · 0.85
IsStreamActiveFunction · 0.85
GetTextPropertyTypeFunction · 0.85
GetPropertyFunction · 0.85
CheckTextDirectionFunction · 0.85
GetTextPathOptionsFunction · 0.85
GetTextAnimatorsFunction · 0.85
GetFirstBaseLinesByPosFunction · 0.85
insertMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected