Skip to content

Commit 9b94b63

Browse files
paxbunMarijnS95
andauthored
ndk: Add bindings for AFont and friends (#397)
Co-authored-by: Marijn Suijten <[email protected]>
1 parent 5c89cf6 commit 9b94b63

File tree

10 files changed

+4166
-3223
lines changed

10 files changed

+4166
-3223
lines changed

ndk-sys/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# 0.5.0-beta.0 (2023-08-15)
44

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

78
# 0.4.1 (2022-11-23)
89

ndk-sys/generate_bindings.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
#!/bin/sh
22

3-
sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/linux-x86_64/sysroot/
3+
os=$(uname -s)
4+
5+
if [[ "$os" == "Darwin" ]]; then
6+
host_tag="darwin-x86_64"
7+
elif [[ "$os" == "CYGWIN"* ]]; then
8+
host_tag="windows-x86_64"
9+
else
10+
host_tag="linux-x86_64"
11+
fi
12+
13+
sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/${host_tag}/sysroot/
414
[ ! -d "$sysroot" ] && echo "Android sysroot $sysroot does not exist!" && exit 1
515

616
while read ARCH && read TARGET ; do

ndk-sys/src/ffi_aarch64.rs

Lines changed: 883 additions & 789 deletions
Large diffs are not rendered by default.

ndk-sys/src/ffi_arm.rs

Lines changed: 900 additions & 806 deletions
Large diffs are not rendered by default.

ndk-sys/src/ffi_i686.rs

Lines changed: 904 additions & 810 deletions
Large diffs are not rendered by default.

ndk-sys/src/ffi_x86_64.rs

Lines changed: 908 additions & 814 deletions
Large diffs are not rendered by default.

ndk-sys/wrapper.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@
2020
#include <android/dlext.h>
2121
#include <android/fdsan.h>
2222
#include <android/file_descriptor_jni.h>
23-
// #include <android/font.h>
24-
// #include <android/font_matcher.h>
23+
// <android/font.h> is broken without the following typedef in C
24+
typedef struct AFont AFont;
25+
#include <android/font.h>
26+
// <android/font_matcher.h> is broken without the following typedef in C
27+
typedef struct AFontMatcher AFontMatcher;
28+
#include <android/font_matcher.h>
2529
#include <android/hardware_buffer.h>
2630
#include <android/hardware_buffer_jni.h>
2731
#include <android/hdr_metadata.h>
@@ -49,7 +53,9 @@
4953
#include <android/surface_texture.h>
5054
#include <android/surface_texture_jni.h>
5155
#include <android/sync.h>
52-
// #include <android/system_fonts.h>
56+
// <android/system_fonts.h> is broken without the following typedef in C
57+
typedef struct ASystemFontIterator ASystemFontIterator;
58+
#include <android/system_fonts.h>
5359
// #include <android/thermal.h>
5460
#include <android/trace.h>
5561
#include <android/versioning.h>

ndk/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- **Breaking:** Upgrade to [`ndk-sys 0.5.0`](../ndk-sys/CHANGELOG.md#050-TODO). (#370)
1111
- **Breaking:** Upgrade `bitflags` crate from `1` to `2`. (#394)
1212
- bitmap: Add `try_format()` to `AndroidBitmapInfo` to handle unexpected formats without panicking. (#395)
13+
- Add `Font` bindings. (#397)
1314
- **Breaking:** Upgrade `num_enum` crate from `0.5.1` to `0.7`. (#398, #419)
1415
- **Breaking:** Renamed and moved "`media`" error types and helpers to a new `media_error` module. (#399)
1516
- **Breaking:** media_codec: Wrap common dequeued-buffer status codes in enum. (#401)

0 commit comments

Comments
 (0)