summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfedittext.cpp
AgeCommit message (Collapse)Author
2017-06-09Fix types for FT_ULong chars in fpdfedittextchromium/3128chromium/3127Nicolas Pena
FXFT_Get_First(Next)_Char can return large unsigned values. This CL avoids integer overflow and adds some missing checks regarding the ranges of the values returned by those methods. Bug: chromium:727086 Change-Id: Ice7bbb3759e384b7174680a82a2a9380c3611382 Reviewed-on: https://pdfium-review.googlesource.com/6436 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-26Add public API for setting the fill color on a text objectwileyrya
BUG=pdfium:719 R=npm@chromium.org Change-Id: Ifd9330de265f8419d588b65fbd6a6187f17badd1 Reviewed-on: https://pdfium-review.googlesource.com/5950 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-23Do not include large unicode values in the ToUnicode mapNicolas Pena
Freetype can get to values larger than 0x10FFFF, but our current implementation of the ToUnicode mapping and the function FXSYS_ToUTF16BE does not support these values. Bug: chromium:724962 Change-Id: I7069f33429527dbf2d0bfd2033512fe909970c02 Reviewed-on: https://pdfium-review.googlesource.com/5810 Commit-Queue: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-17Add some missing keywords in ToUnicodeNicolas Pena
Bug: pdfium:667 Change-Id: I8c3d07d2c533e6dd2a98099673b136c587c37a98 Reviewed-on: https://pdfium-review.googlesource.com/5630 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-16Be skeptical of bare |new|s.Tom Sepez
In particular, prefer an explicit .release() call when handing ownership of an object to a caller across a C-API. Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1 Reviewed-on: https://pdfium-review.googlesource.com/5470 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-05Encode unicodes in UTF-16BE in ToUnicode mapNicolas Pena
Bug: pdfium:667 Change-Id: I811571c334ff28162905a65781ca14f03caf2966 Reviewed-on: https://pdfium-review.googlesource.com/4910 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-04CPDF_Document::GetPageData() normally does not return NULL.Lei Zhang
Add a comment to clarify and remove some unneeded checks. Change-Id: I8b0492548b245abc45e161085047c9f36d6c8e2b Reviewed-on: https://pdfium-review.googlesource.com/4871 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04Make CPDF_Font member variables protected.Lei Zhang
Change-Id: I5d452ea907f4d243645ddae3512776096a827522 Reviewed-on: https://pdfium-review.googlesource.com/4872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-03Add a ToUnicode mapping when loading CID fontsNicolas Pena
This CL adds ToUnicode for CID fonts and adds a test to prove that using it works as intended. The test uses a Linux font for Japanese characters, and tests for other OS will be added in a followup. The ToUnicode works by defining the PDF charcodes as equal to the glyph indices and assuming that the freetype charcodes given by FXFT_Get_Next_Char are in fact the unicode values. Bug: pdfium:667 Change-Id: I419724b87c3936c730a05f771548ae4787a576eb Reviewed-on: https://pdfium-review.googlesource.com/4810 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-02Add API to create a text object using a loaded font.Nicolas Pena
There is already a method to add text from standard font, this CL adds an option to add text using a loaded font. The font set into a text object is ref counted and may be released, so call LoadFont on this new text obj, and add a method to close the font. This CL also improves the SetText method so that it now uses a WideString, in preparation for CID fonts with non-Latin characters. Bug: pdfium:667 Change-Id: I6829d702357d2a898a12f5297e4fd2ec993a9891 Reviewed-on: https://pdfium-review.googlesource.com/4770 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Make most PDFium code pass Clang plugin's auto raw check.Lei Zhang
Change-Id: I9dc32342e24361389841ecba83081a97fc043377 Reviewed-on: https://pdfium-review.googlesource.com/2959 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-06Add public method FPDFText_LoadFont to load some types of fonts.Nicolas Pena
The new method replaces the previous one for loading only type1 fonts. This will create the font dictionary with the very basics needed, according to the tables in chapter 5 of the PDF spec. The tests for now are only checking that the information is getting passed on properly. Followup: adding text with those fonts, generating the contents (doing that will allow testing whether the parts that I've skipped like Encoding and cmaps are needed or not). BUG=pdfium:667 Change-Id: Id1a61501e09542804a391552fd002f2caed41939 Reviewed-on: https://pdfium-review.googlesource.com/2915 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-27Add public API for creating a Type1 fontNicolas Pena
Given a stream of data, we create a type1 font and fill up the required dictionary entries according to PDF spec 1.7. Table 5.8 describes Type 1 font dictionaries, and Table 5.19 describes font descriptors. BUG=pdfium:667 Change-Id: I571b09fb533467d77ed0104e613726387aec1f87 Reviewed-on: https://pdfium-review.googlesource.com/2835 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-02-15Add public API for adding text with standard fontsNicolas Pena
BUG=pdfium:667 Change-Id: I05e301385a7af4b6ce27dc0b885e23646abf3dd9 Reviewed-on: https://pdfium-review.googlesource.com/2711 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>