Add an accessor for the symbol's text object

46 views
Skip to first unread message

Dmitry Panteleev

unread,
May 7, 2024, 12:23:31 PMMay 7
to pdfium
Hello Pdfium devs,

Looks like currently it is not possible to find the text object which contains a symbol using the public API. If text overlaps, it means that is not trivial to create a tree above it if we need some acess to mcid. 

is it ok if I expose 

FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFText_GetTextObject(FPDF_TEXTPAGE text_page,  int index) {
  // ...
  const CPDF_TextPage::CharInfo& charinfo = textpage->GetCharInfo(index);

  return FPDFPageObjectFromCPDFPageObject(charinfo.m_pTextObj.get());
}

in the public api? 

geisserml

unread,
May 7, 2024, 5:27:23 PMMay 7
to pdfium
Currently the only way to get a text pageobject is through FPDFPage_GetObject() or FPDFPageObj_NewTextObj(), right?

Dmitry Panteleev

unread,
May 7, 2024, 7:46:55 PMMay 7
to pdfium
Yes, looks like the only one which returns an object (without modifying things) is FPDFPage_GetObject. But there are plenty of accessors which call textpage->GetCharInfo(index) to get text style or bounding box, so I don't see any harm in exposing the corresponding text object directly in API. 

Lei Zhang

unread,
May 8, 2024, 7:08:06 PMMay 8
to Dmitry Panteleev, pdfium
I think this API should be ok. In some ways, it is similar to
FPDFAnnot_GetObject().

With this API, PDFium can remove FPDFText_GetTextRenderMode(), and the
embedder can call FPDFText_GetTextObject() followed by
FPDFTextObj_GetTextRenderMode() instead.
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/750c4dc3-cc7e-4b3b-b607-ca926a86e1e2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages