Skip to content

Commit

Permalink
ndk: Add bindings for AFont and friends (#397)
Browse files Browse the repository at this point in the history
Co-authored-by: Marijn Suijten <[email protected]>
  • Loading branch information
paxbun and MarijnS95 authored Aug 16, 2023
1 parent 5c89cf6 commit 9b94b63
Show file tree
Hide file tree
Showing 10 changed files with 4,166 additions and 3,223 deletions.
1 change: 1 addition & 0 deletions ndk-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# 0.5.0-beta.0 (2023-08-15)

- **Breaking:** Regenerate against NDK `25.2.9519653` with `rust-bindgen 0.66.0`. (#324, #370)
- Add `font`, `font_matcher`, `system_fonts` bindings. (#397)

# 0.4.1 (2022-11-23)

Expand Down
12 changes: 11 additions & 1 deletion ndk-sys/generate_bindings.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/sh

sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/linux-x86_64/sysroot/
os=$(uname -s)

if [[ "$os" == "Darwin" ]]; then
host_tag="darwin-x86_64"
elif [[ "$os" == "CYGWIN"* ]]; then
host_tag="windows-x86_64"
else
host_tag="linux-x86_64"
fi

sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/${host_tag}/sysroot/
[ ! -d "$sysroot" ] && echo "Android sysroot $sysroot does not exist!" && exit 1

while read ARCH && read TARGET ; do
Expand Down
1,672 changes: 883 additions & 789 deletions ndk-sys/src/ffi_aarch64.rs

Large diffs are not rendered by default.

1,706 changes: 900 additions & 806 deletions ndk-sys/src/ffi_arm.rs

Large diffs are not rendered by default.

1,714 changes: 904 additions & 810 deletions ndk-sys/src/ffi_i686.rs

Large diffs are not rendered by default.

1,722 changes: 908 additions & 814 deletions ndk-sys/src/ffi_x86_64.rs

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions ndk-sys/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
#include <android/dlext.h>
#include <android/fdsan.h>
#include <android/file_descriptor_jni.h>
// #include <android/font.h>
// #include <android/font_matcher.h>
// <android/font.h> is broken without the following typedef in C
typedef struct AFont AFont;
#include <android/font.h>
// <android/font_matcher.h> is broken without the following typedef in C
typedef struct AFontMatcher AFontMatcher;
#include <android/font_matcher.h>
#include <android/hardware_buffer.h>
#include <android/hardware_buffer_jni.h>
#include <android/hdr_metadata.h>
Expand Down Expand Up @@ -49,7 +53,9 @@
#include <android/surface_texture.h>
#include <android/surface_texture_jni.h>
#include <android/sync.h>
// #include <android/system_fonts.h>
// <android/system_fonts.h> is broken without the following typedef in C
typedef struct ASystemFontIterator ASystemFontIterator;
#include <android/system_fonts.h>
// #include <android/thermal.h>
#include <android/trace.h>
#include <android/versioning.h>
Expand Down
1 change: 1 addition & 0 deletions ndk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- **Breaking:** Upgrade to [`ndk-sys 0.5.0`](../ndk-sys/CHANGELOG.md#050-TODO). (#370)
- **Breaking:** Upgrade `bitflags` crate from `1` to `2`. (#394)
- bitmap: Add `try_format()` to `AndroidBitmapInfo` to handle unexpected formats without panicking. (#395)
- Add `Font` bindings. (#397)
- **Breaking:** Upgrade `num_enum` crate from `0.5.1` to `0.7`. (#398, #419)
- **Breaking:** Renamed and moved "`media`" error types and helpers to a new `media_error` module. (#399)
- **Breaking:** media_codec: Wrap common dequeued-buffer status codes in enum. (#401)
Expand Down
Loading

0 comments on commit 9b94b63

Please sign in to comment.