Closed fraguada closed 3 months ago
py work fine on linux but takes different routes to get Plain Text
and Rich Text
, etc
js/py bindings go to
const ON_wString ON_Annotation::PlainText() const
{
if (nullptr == m_text)
return ON_wString::EmptyString;
const ON_TextRunArray* runs = m_text->TextRuns(true);
if (nullptr != runs && 0 == runs->Count())
BoundingBox(); // Side effect of building text runs
return m_text->PlainText();
}
and dotnet: https://github.com/mcneel/rhino3dm/blob/main/src/librhino3dm_native/on_text.cpp#L98
RH_C_FUNCTION void ON_V6_Annotation_GetTextString(const ON_Annotation* constAnnotation, ON_wString* wstring, bool rich)
{
if (nullptr != wstring)
{
if (constAnnotation)
{
if (rich)
{
const ON_TextContent* text_content = constAnnotation->Text();
if(nullptr != text_content)
(*wstring) = text_content->PlatformRichTextFromRuns();
}
else
(*wstring) = constAnnotation->PlainText();
}
else
*wstring = ON_wString::EmptyString;
}
}
js / py only have RichText and PlainText exposed, need to expose PlainTextWithFields. js outputs empty string for RichText.
For a 3dm with a text entity that has "Hello World!" as text, the outputs on linux
{\rtf1\deff0{\fonttbl{\f0 HelveticaNeue;}{\f1 Avenir-Black;}}\f0 \fs18{\f1 Hello World!}}
Works across languages and platforms!
published a beta to nuget: https://www.nuget.org/packages/Rhino3dm/8.6.0-beta
Seems reading these on windows works fine, but breaks under linux.