From 6ff0a202b291a6cc7110f25311131040e336f80b Mon Sep 17 00:00:00 2001 From: Takashi Kawasaki Date: Fri, 26 Apr 2024 22:13:56 +0900 Subject: [PATCH] chromium/6406 --- android/CMakeLists.txt | 2 +- darwin/pdfium/build-config.sh | 4 +- lib/src/pdfium/pdfium_bindings.dart | 64 +++++++++++++++++++++++++++++ linux/CMakeLists.txt | 2 +- pubspec.yaml | 14 +++---- windows/CMakeLists.txt | 2 +- 6 files changed, 76 insertions(+), 12 deletions(-) diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index b838967..8031f2c 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -12,7 +12,7 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DI # versions of CMake. cmake_policy(VERSION 3.14...3.25) -set(PDFIUM_RELEASE chromium%2F6259) +set(PDFIUM_RELEASE chromium%2F6406) set(PDFIUM_DIR ${CMAKE_BINARY_DIR}/pdfium) set(PDFIUM_RELEASE_DIR ${PDFIUM_DIR}/${PDFIUM_RELEASE}) diff --git a/darwin/pdfium/build-config.sh b/darwin/pdfium/build-config.sh index 488b426..218a6be 100755 --- a/darwin/pdfium/build-config.sh +++ b/darwin/pdfium/build-config.sh @@ -5,8 +5,8 @@ if [ "$2" = "" ]; then exit 1 fi -# https://pdfium.googlesource.com/pdfium/+/refs/heads/chromium/6150 -LAST_KNOWN_GOOD_COMMIT=1e9d89db3c00fd1eab2959bd063832bebe6b868d +# https://pdfium.googlesource.com/pdfium/+/refs/heads/chromium/6406 +LAST_KNOWN_GOOD_COMMIT=b756612c7933bafd2d21d8d60c2cbcc46978594c SCRIPT_DIR=$(cd $(dirname $0) && pwd) diff --git a/lib/src/pdfium/pdfium_bindings.dart b/lib/src/pdfium/pdfium_bindings.dart index 1706e82..da75ebd 100644 --- a/lib/src/pdfium/pdfium_bindings.dart +++ b/lib/src/pdfium/pdfium_bindings.dart @@ -2151,6 +2151,37 @@ class pdfium { late final _FPDFAnnot_SetURI = _FPDFAnnot_SetURIPtr.asFunction< int Function(FPDF_ANNOTATION, ffi.Pointer)>(); + FPDF_ATTACHMENT FPDFAnnot_GetFileAttachment( + FPDF_ANNOTATION annot, + ) { + return _FPDFAnnot_GetFileAttachment( + annot, + ); + } + + late final _FPDFAnnot_GetFileAttachmentPtr = + _lookup>( + 'FPDFAnnot_GetFileAttachment'); + late final _FPDFAnnot_GetFileAttachment = _FPDFAnnot_GetFileAttachmentPtr + .asFunction(); + + FPDF_ATTACHMENT FPDFAnnot_AddFileAttachment( + FPDF_ANNOTATION annot, + FPDF_WIDESTRING name, + ) { + return _FPDFAnnot_AddFileAttachment( + annot, + name, + ); + } + + late final _FPDFAnnot_AddFileAttachmentPtr = _lookup< + ffi.NativeFunction< + FPDF_ATTACHMENT Function(FPDF_ANNOTATION, + FPDF_WIDESTRING)>>('FPDFAnnot_AddFileAttachment'); + late final _FPDFAnnot_AddFileAttachment = _FPDFAnnot_AddFileAttachmentPtr + .asFunction(); + FPDF_TEXTPAGE FPDFText_LoadPage( FPDF_PAGE page, ) { @@ -5011,6 +5042,38 @@ class pdfium { late final _FPDFText_LoadStandardFont = _FPDFText_LoadStandardFontPtr .asFunction(); + FPDF_FONT FPDFText_LoadCidType2Font( + FPDF_DOCUMENT document, + ffi.Pointer font_data, + int font_data_size, + FPDF_BYTESTRING to_unicode_cmap, + ffi.Pointer cid_to_gid_map_data, + int cid_to_gid_map_data_size, + ) { + return _FPDFText_LoadCidType2Font( + document, + font_data, + font_data_size, + to_unicode_cmap, + cid_to_gid_map_data, + cid_to_gid_map_data_size, + ); + } + + late final _FPDFText_LoadCidType2FontPtr = _lookup< + ffi.NativeFunction< + FPDF_FONT Function( + FPDF_DOCUMENT, + ffi.Pointer, + ffi.Uint32, + FPDF_BYTESTRING, + ffi.Pointer, + ffi.Uint32)>>('FPDFText_LoadCidType2Font'); + late final _FPDFText_LoadCidType2Font = + _FPDFText_LoadCidType2FontPtr.asFunction< + FPDF_FONT Function(FPDF_DOCUMENT, ffi.Pointer, int, + FPDF_BYTESTRING, ffi.Pointer, int)>(); + int FPDFTextObj_GetFontSize( FPDF_PAGEOBJECT text, ffi.Pointer size, @@ -6484,6 +6547,7 @@ typedef FPDF_WIDESTRING = ffi.Pointer; typedef FPDF_ANNOT_APPEARANCEMODE = ffi.Int; typedef DartFPDF_ANNOT_APPEARANCEMODE = int; typedef FPDF_LINK = ffi.Pointer; +typedef FPDF_ATTACHMENT = ffi.Pointer; typedef FPDF_TEXTPAGE = ffi.Pointer; typedef FPDF_SCHHANDLE = ffi.Pointer; typedef FPDF_PAGELINK = ffi.Pointer; diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 71acf9b..e71fa3c 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -29,7 +29,7 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DI # versions of CMake. cmake_policy(VERSION 3.14...3.25) -set(PDFIUM_RELEASE chromium%2F6259) +set(PDFIUM_RELEASE chromium%2F6406) set(PDFIUM_DIR ${CMAKE_BINARY_DIR}/pdfium) set(PDFIUM_RELEASE_DIR ${PDFIUM_DIR}/${PDFIUM_RELEASE}) diff --git a/pubspec.yaml b/pubspec.yaml index 15b4bbf..b1891ad 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,14 +51,14 @@ ffigen: bindings: 'lib/src/pdfium/pdfium_bindings.dart' headers: entry-points: - - 'example/build/windows/x64/.lib/latest/include/fpdfview.h' - - 'example/build/windows/x64/.lib/latest/include/fpdf_annot.h' - - 'example/build/windows/x64/.lib/latest/include/fpdf_text.h' - - 'example/build/windows/x64/.lib/latest/include/fpdf_doc.h' - - 'example/build/windows/x64/.lib/latest/include/fpdf_edit.h' - - 'example/build/windows/x64/.lib/latest/include/fpdf_formfill.h' + - 'example/viewer/build/windows/x64/.lib/latest/include/fpdfview.h' + - 'example/viewer/build/windows/x64/.lib/latest/include/fpdf_annot.h' + - 'example/viewer/build/windows/x64/.lib/latest/include/fpdf_text.h' + - 'example/viewer/build/windows/x64/.lib/latest/include/fpdf_doc.h' + - 'example/viewer/build/windows/x64/.lib/latest/include/fpdf_edit.h' + - 'example/viewer/build/windows/x64/.lib/latest/include/fpdf_formfill.h' include-directives: - - 'example/build/windows/x64/.lib/latest/include/**' + - 'example/viewer/build/windows/x64/.lib/latest/include/**' preamble: | // ignore_for_file: unused_field name: 'pdfium' diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index a23aae9..0e71027 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -16,7 +16,7 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DI # versions of CMake. cmake_policy(VERSION 3.14...3.25) -set(PDFIUM_RELEASE chromium%2F6259) +set(PDFIUM_RELEASE chromium%2F6406) set(PDFIUM_DIR ${CMAKE_BINARY_DIR}/pdfium) set(PDFIUM_RELEASE_DIR ${PDFIUM_DIR}/${PDFIUM_RELEASE})