Skip to content

Commit

Permalink
chromium/6406
Browse files Browse the repository at this point in the history
  • Loading branch information
espresso3389 committed Apr 26, 2024
1 parent ec4902e commit 6ff0a20
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 12 deletions.
2 changes: 1 addition & 1 deletion android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
4 changes: 2 additions & 2 deletions darwin/pdfium/build-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
64 changes: 64 additions & 0 deletions lib/src/pdfium/pdfium_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,37 @@ class pdfium {
late final _FPDFAnnot_SetURI = _FPDFAnnot_SetURIPtr.asFunction<
int Function(FPDF_ANNOTATION, ffi.Pointer<ffi.Char>)>();

FPDF_ATTACHMENT FPDFAnnot_GetFileAttachment(
FPDF_ANNOTATION annot,
) {
return _FPDFAnnot_GetFileAttachment(
annot,
);
}

late final _FPDFAnnot_GetFileAttachmentPtr =
_lookup<ffi.NativeFunction<FPDF_ATTACHMENT Function(FPDF_ANNOTATION)>>(
'FPDFAnnot_GetFileAttachment');
late final _FPDFAnnot_GetFileAttachment = _FPDFAnnot_GetFileAttachmentPtr
.asFunction<FPDF_ATTACHMENT Function(FPDF_ANNOTATION)>();

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_ATTACHMENT Function(FPDF_ANNOTATION, FPDF_WIDESTRING)>();

FPDF_TEXTPAGE FPDFText_LoadPage(
FPDF_PAGE page,
) {
Expand Down Expand Up @@ -5011,6 +5042,38 @@ class pdfium {
late final _FPDFText_LoadStandardFont = _FPDFText_LoadStandardFontPtr
.asFunction<FPDF_FONT Function(FPDF_DOCUMENT, FPDF_BYTESTRING)>();

FPDF_FONT FPDFText_LoadCidType2Font(
FPDF_DOCUMENT document,
ffi.Pointer<ffi.Uint8> font_data,
int font_data_size,
FPDF_BYTESTRING to_unicode_cmap,
ffi.Pointer<ffi.Uint8> 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.Uint8>,
ffi.Uint32,
FPDF_BYTESTRING,
ffi.Pointer<ffi.Uint8>,
ffi.Uint32)>>('FPDFText_LoadCidType2Font');
late final _FPDFText_LoadCidType2Font =
_FPDFText_LoadCidType2FontPtr.asFunction<
FPDF_FONT Function(FPDF_DOCUMENT, ffi.Pointer<ffi.Uint8>, int,
FPDF_BYTESTRING, ffi.Pointer<ffi.Uint8>, int)>();

int FPDFTextObj_GetFontSize(
FPDF_PAGEOBJECT text,
ffi.Pointer<ffi.Float> size,
Expand Down Expand Up @@ -6484,6 +6547,7 @@ typedef FPDF_WIDESTRING = ffi.Pointer<FPDF_WCHAR>;
typedef FPDF_ANNOT_APPEARANCEMODE = ffi.Int;
typedef DartFPDF_ANNOT_APPEARANCEMODE = int;
typedef FPDF_LINK = ffi.Pointer<fpdf_link_t__>;
typedef FPDF_ATTACHMENT = ffi.Pointer<fpdf_attachment_t__>;
typedef FPDF_TEXTPAGE = ffi.Pointer<fpdf_textpage_t__>;
typedef FPDF_SCHHANDLE = ffi.Pointer<fpdf_schhandle_t__>;
typedef FPDF_PAGELINK = ffi.Pointer<fpdf_pagelink_t__>;
Expand Down
2 changes: 1 addition & 1 deletion linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
14 changes: 7 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down

0 comments on commit 6ff0a20

Please sign in to comment.