summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edittext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_edittext.cpp')
-rw-r--r--fpdfsdk/fpdf_edittext.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 8186d8d894..a927e16e14 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -394,6 +394,11 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
return pDoc->LoadFont(fontDict);
}
+CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
+ auto* obj = CPDFPageObjectFromFPDFPageObject(page_object);
+ return obj ? obj->AsText() : nullptr;
+}
+
} // namespace
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
@@ -481,6 +486,31 @@ FPDFText_SetFillColor(FPDF_PAGEOBJECT text_object,
return FPDFPageObj_SetFillColor(text_object, R, G, B, A);
}
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text,
+ double* a,
+ double* b,
+ double* c,
+ double* d,
+ double* e,
+ double* f) {
+ if (!text || !a || !b || !c || !d || !e || !f)
+ return false;
+
+ CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
+ if (!pTextObj)
+ return false;
+
+ CFX_Matrix text_matrix = pTextObj->GetTextMatrix();
+ *a = text_matrix.a;
+ *b = text_matrix.b;
+ *c = text_matrix.c;
+ *d = text_matrix.d;
+ *e = text_matrix.e;
+ *f = text_matrix.f;
+
+ return true;
+}
+
FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font) {
CPDF_Font* pFont = CPDFFontFromFPDFFont(font);
if (!pFont)